Corinna Vinschen wrote:
The actual test scripts & tools from this use case pass local usernames
from/to non-Cygwin programs and rely on the fact that Cygwin and Windows
username match.
For the long term, have some cyguser, cyggroup tools (similar to cygpath)
which convert the names would be helpful.
Feel free to provide them. I'm not quite sure what kind of conversion
you're thinking about. Cygwin->Windows? If so, you can get that
with simple scripts:
pwd_entry=$(/usr/bin/getent passwd "$username")
# Extract Windows username and domain
tmp="${pwd_entry#*:*:*:*U-}"
tmp="${pwd_entry%%,*}"
domain="${tmp%\\*}"
username="${tmp#*\\}"
Works, except when Cygwin does not provide a "U-*\NAME," in the gecos
field. This is the case for Local Service, Network Service and
Administrators.
Tested in db-only mode with 1.7.34-001:
$ getent passwd localservice
localservice:*:19:19:,S-1-5-19:/:/sbin/nologin
BTW, TrustedInstaller is not found by getent:
$ getent passwd TrustedInstaller ; echo $?
2
$ getent passwd 328384 ; echo $?
2
Same result for 'group'
but:
$ ls -l -d /cygdrive/c/Windows
drwxrwx---+ 1 TrustedInstaller TrustedInstaller 0 Nov 15 11:08
/cygdrive/c/Windows
$ ls -l -n -d /cygdrive/c/Windows
drwxrwx---+ 1 328384 328384 0 Nov 15 11:08 /cygdrive/c/Windows
$ getent passwd S-1-5-80-956008885-...
TrustedInstaller:*:328384:328384:,S-1-5-80-956008885-...:/:/sbin/nologin
What will be the future 'official' way for the opposite Windows->Cygwin
conversion? Some tool that uses CW_CYGNAME_FROM_WINNAME ?
Christian
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple