With nsswitch db_home of /cygdrive/c/%U ssh can't seem to use .ssh folder

Corinna Vinschen corinna-cygwin@cygwin.com
Fri Dec 18 16:12:00 GMT 2015

On Dec 18 10:02, Byron wrote:
> Every time I use ssh to a machine I get the fingerprint warnings like
> it's the first time I've ssh-ed to that machine. I've narrowed it down
> to have something to do with my `db_home` being set to `/cygdrive/c/%U`
> in `nsswitch.conf`. I have it set to this value because I want my
> Cygwin home folder to be the home folder of my computer. Since I'm on
> an Active Directory network if I set `db_home` to `windows` then my
> home folder is on a network file server rather than my desktop.
> I can't see any reason that ssh isn't able to properly use my `.ssh`
> folder. Am I missing something, or is this a bug?

I have no idea.  Usually it works.

> Below is sample output of ssh, the permissions of my `.ssh/` folder and
> files, and the contents of my `/etc/nsswitch.conf`.
> ```
> $ ssh destination
> Could not create directory '/cygdrive/c/bkboulton/.ssh'.

It's weird that ssh apparently tries to create the directory as if it's
missing.  You didn't change the cygdrive prefix in /etc/fstab by any

Also, usually your Windows home folder is not /cygdrive/c/$USERNAME but
/cygdrive/c/Users/$USERNAME.  Are you sure that's not the problem here?

> The authenticity of host 'destination (' can't be
> established. RSA key fingerprint is
> SHA256:WKewPf3j9Vljltmsnr/cwZmr0XBy8L5E6Chwp1gWK4g. Are you sure you
> want to continue connecting (yes/no)?
> ```
> Permissions of my `/cygdrive/c/bkboulton/.ssh` folder ar `drwx------+`.

The '+' is suspicious.  What does icacls print for .ssh?

> Permissions on all file in that folder are `-rw-r--r--`.

All files?  Even the private keys?  The permissions for private
keys should be 0600.

What does `getent passwd <your cygwin username>' print?  Does
the homedir differ from the value of $HOME?

Can you run ssh under strace as in

  $ strace -o ssh.trace ssh destination

and provide the trace output?  It might contain a hint why ssh
thinks it has to create the folder.

What you could also try is this:  Disable the db_home entry in
nsswitch.conf and create a mount point instead, e.g.:

  $ cat > /etc/fstab.d/$USER <<EOF
  C:/Users/$USER /home/$USER ntfs binary 0 0

That makes your home dir /home/<username> in Cygwin.  Just start a new
shell for testing.


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/20151218/1177a427/attachment.sig>

More information about the Cygwin mailing list