To verify if Cygwin (cygrunsrv) is installed properly, run C:\cygwin\Cygwin.bat, and execute the following command:
cygrunsrv -h
If Cygwin is installed properly, then all the Cygwin help options are displayed on the screen. However, if this command returns an error message, then you may have to reinstall Cygwin.
To configure the SSHD service, run C:\cygwin\Cygwin.bat, and execute the following command:
ssh-host-config
After running the command, you are prompted the following questions:
- Query: Should privilege separation be used? : yes
- Query: New local account 'sshd'? : yes
- Query: Do you want to install sshd as a service?
- Query: : yes
- Query: Enter the value of CYGWIN for the deamon: [] binmode ntsec
- Query: Do you want to use a different name? (yes/no) yes/no
At this point, if you want to use the same name, that is cyg_server, enter no. You are then prompted the following questions:
- Query: Create new privileged user account 'cyg_server'? (yes/no) yes
- Query: Please enter the password:
- Query: Renter:
However, if you want to use a different name, enter yes. You are then prompted the following questions:
- Query: Enter the new user name: cyg_server1
- Query: Reenter: cyg_server1
- Query: Create new privileged user account 'cyg_server1'? (yes/no) yes
- Query: Please enter the password:
- Query: Reenter:
If the configuration is successful, you will see the following message:
Host configuration finished. Have fun!
1What is the output of
echo $HOME
in Cygwin? The ssh config will be loaded from~/.ssh/config
, which may be different then%HOME/.ssh/config
. – Matt Clark – 2016-01-14T02:43:34.110@MattClark If I open the "Cygwin64 Terminal" shortcut created by Cygwin setup (runs
C:\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico -
),echo $HOME
shows "/home/Vince" (real directory is C:\cygwin64\home\Vince). If I run C:\cygwin64\Cygwin.bat (runsbash --login -i
), it shows "/cygdrive/c/Users/Vince". I don't understand why MinTTY does something different. Both commands effectively run bash as an interactive login shell. The bash man page says that it uses the value of theHOME
variable when performing tilde expansion. – Vince – 2016-01-14T03:12:57.150It is indeed looking in C:\cygwin64\home\Vince.ssh. When I copied the config file there from C:\Users\Vince.ssh, it worked. I'm not sure this is a solution, though. I'd rather not have two copies of the config file (one for git and one for ssh). I also don't understand how ssh knows where the Cygwin user's home directory is. In the ssh man page, it says that the default location of the config file is
~/.ssh/config
, but tilde expansion is performed by the bash shell that isn't running. – Vince – 2016-01-14T03:22:16.090And a sort of a workaround that seems less likely to break something... In Cygwin Terminal:
rm -rf ~/.ssh
ln -s /cygdrive/c/Users/Vince/.ssh
– Vince – 2016-01-14T05:48:35.930In the beginning I think I just symlined my whole user directory,
/home/me
->/cygdrive/c/Users/me
. I was trying to get it to work the proper way :/ – Matt Clark – 2016-01-14T05:53:45.870