ssh config under cygwin

Install the openssh package and then run ssh-host-config. It will generate a "ssh_config" file in /etc/.


I had the same issue. I wanted to use ~/.ssh/config because I was already using that directory for other applications and didn't want to maintain 2 copies. So creating an /etc/ssh_config directory wasn't the ideal solution.

As Fujimoto Youichi mentions, ssh looks at /etc/passwd for your home directory and not the $HOME environment variable.

The current cygwin versions (I'm using 2.6) no longer creates /etc/passwd as part of the install. However, it is easy to create a new one:

    mkpasswd -c -p "$(cygpath -H)" > /etc/passwd
  • -c Adds the current user to the passwd file
  • -p "$(cygpath -H)" Adds your current home directory

https://cygwin.com/cygwin-ug-net/mkpasswd.html has more details on the available flags.

I haven't looked at the code, but ssh's preference seems to be:

  1. /etc/ssh_config
  2. ~/.ssh/config

So if you only want to use the ssh configuration information from ~/.ssh/config, then be sure to delete /etc/ssh_config.

Also, be sure to open a new cygwin terminal window after making changes, for them to become available.