Corinna Vinschen corinna-cygwin@cygwin.com
Sun Feb 15 10:13:00 GMT 2015

On Feb 13 19:30, Denis Excoffier wrote:
> On 2015-02-12 21:23, Corinna Vinschen wrote:
> > 
> > Hi Cygwin friends and users,
> > 
> > 
> > I released a very early TEST version of the next upcoming Cygwin
> > release.  The version number is 1.7.35-0.1.
> > 
> ...
> > ====================================================================
> > If you're not familiar with the new account information handling
> > introduced in Cygwin 1.7.34, I suggest to read the new documentation
> > at https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-mapping
> > ====================================================================
> > 
> > The essential changes in this test release are:
> > 
> > - The default settings for db_home, db_shell, and db_gecos in case
> >  there's no /etc/nsswitch.conf file, or if they are not mentioned 
> >  in /etc/nsswitch.conf, are now set to just the fallback, which is
> > 
> >    db_home: /home/%U
> >    db_shell: /bin/bash
> >    db_gecos: <empty>
> > 
> I tried (according to the new documentation):
> db_home: /%H/%U/cygdir
> and that was fine but %H was replaced by the
> /cygdrive/C/Document and Settings/<user> prefix, although i was
> expecting the /cygdrive/C/Home/<user> prefix instead.

I'm sorry, but... why and how on earth did you expect that?

%H is the Windows home directory in POSIX style.  It's *not* just
something in your environment, how could it be?  Consider checking the
passwd entry for some other user:

  $ getent passwd john.lennon

The home directory of this account has to be computed from what Windows
provides on information and the environment of the current user has
nothing to do with it.

The Windows home directory is computed as follows:

- If the account is an AD account, fetch the account's homeDrive and
  homeDirectory attributes from AD.
  The 100% right thing to do at this point is to check if homeDrive is
  non-empty.  If so, it would be used to generate the path, e.g.
  homeDrive == Z: ==>  %H == /cygdrive/z

  However, after discussions on this list, I disabled this part.  The
  drive letter in homeDrive may not always be available when it's
  needed (ssh login).
  Rather, Cygwin just checks if homeDirectory is non-empty and if so, it
  uses that to create %H.

- Otherwise, if the account is a non-AD account, fetch the same info as
  above from local SAM or the NT4 pre-AD account DB.  Same procedure as

- Otherwise, if the account DB has no home dir info, check the local
  machine.  The fallback for the Windows home directory is the account's
  profile path on the local machine.  So Cygwin checks the registry value

    HKLM/Software/Microsoft/Windows NT/CurrentVersion/ProfileList/<your SID>/ProfileImagePath

  If it exists, it's converted to POSIX style.  If not, %H will not
  generate any useful info for that user.

> I have to confess that i used here the nearly-to-be-obsoleted XP SP3.
> But i also use W7 sometimes, and it would be great if i could
> have "db_home: /%H/%U/cygdir" in both of them (yes my username has to
> appear twice): no /etc/passwd any more.

You can have that and in that case, and if the account DB does not
explicitly specify a home directory you'd get something like


for %H.  So /%H/%U/cygdir would result in



Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150215/76b492a7/attachment.sig>

More information about the Cygwin mailing list