3 September 2012

Install cygwin sshd on Windows

Posted by pathfinder under: General .

Here is a quick tutorial to install cygwin on your windows computer to make your windows computer an SSH and SFTP SERVER.   A couple of house cleaning things before we get started.

  • Note:  If you are looking for a SSH client then download putty.exe as it make s a great SSH client.
  • This tutorial only applies to Cygwin 1.7, installer version 2.774
  • I have only installed this twice so I am by far no expert.  If I missed a step you will have to figure it out yourself.

Now lets get started.

  1. First thing you need to do is download the cygwin setup.exe  from here Cygwin.com.
  2. After downloading, run the setup.exe.  Click Next and choose Install from Internet.
  3. Leave the install directly as c:\cygwin  (unless you have some specific reason to change it.   if you do decide to change, you will be on your own).
  4. Click next and chose a Local Package directly.  In my case I made it my downloads folder “C:\Users\xxxxx\Downloads”
  5. Click next and leave the default option: Direct Connection.
  6. Now you will need to choose a download mirror.    Go to http://cygwin.com/mirrors.html and find the download location closest to where you live.  Find it in the list and select next.
  7. After a moment you will get a list of packages to install.
    1. In the Search box type “ssh”
    2. Expand NET
    3. Click on the “skip”  for the openssh:”The OpenSSH server and client programs”

  8. Click Next
  9. You will get a screen to automatically Resolve dependencies.  Make sure the RECOMMENED option is selected and Click Next.
  10.   The install may take a few minutes to download the necessary packates.   (they will be save to the location you selected in step 4)
  11. After the packages are downloaded and installed,  you will get an option if you want to create shortcuts.   I chose to let the install create the shortcuts and clicked finish.
  12. After installation is finished, open the cygwin terminal as Administrator by righ clicking on the shortcut   and choose Run as Administrator.
  13. In the cygwin terminal type in ssh-host-config
  14. At the first option “Should privelage separation be used? (yes/no)”  type “yes”  (this is the default option)
  15. “new local account ‘sshd’? (yes/no)  type “yes”
  16. “Do you want to install sshd as a service?”  Type “yes”
  17. Next you’ll be asked to “Enter the value of CYGWIN for the daemon: []”  Type “ntsec”
  18. Cygwin will now need to create a user for the service.  The default is ‘cyg_server’.  To use the default Type “no”.
  19. You will be prompted for a password (twice) to assign to this account.  Enter a password.
  20. You have completed the install.   Type “net start sshd” to start the server.
  21. Now you will need to create the user keys.
  22. Exit cygwin by typing in “exit”
  23. Re-open cygwin-terminal as a normal user by clicking on the cygwin-terminal shortcut.  (This will be the user that you will log into ssh terminal with)
  24. In the Terminal type “ssh-user-config”
  25. At the prompt “Shall I create a SSH2 RSA identity file for you? (yes/no)”  Type “yes”
  26. enter a passphrase.  it can be anything you want.
  27. At the prompt “Do you want to use this identity to login to this machine (yes/no) Type “yes”
  28. Next, you’ll be asked to create an SSH2 DSA identiy file, if you want to use password-less access. I declined at this step so I typed “no”
  29. Next you’ll be asked to create an SSH2 ECDSA identity file.  Again I declined and so I typed “no”
  30. Last you’ll be asked to create a (depricated) SSH1 RSA identity file.  I declined this step so I typed “no”
  31. You have now completed setting up your user.
  32. The final step is to add the program C:\cygwin\usr\sbin\sshd.exe to your firewall rules.
    1. Windows Control Panel -> System and Security -> Windows Firewall -> Allow a program through Windows Firewall
    2. Click Change settings
    3. Towards the bottom of the screen click “allow another program…”
    4. Browse to C:\cygwin\usr\sbin\sshd.exe
  33. Also, I needed to set my password before I could log in with putty from a remote computer, so at the cygwin prompt I typed in “passwd” to set my password.  (Note: this will change your windows login password also).

You will now have putty and sftp access to your computer.

3 Comments so far...

Homero Valle Says:

30 October 2012 at 11:03 am.

You can disable password and keyboard interactive authentication by editing the sshd_config file (/etc/sshd_config).

Uncomment and change to no the following lines:
PasswordAuthentication no
ChallengaResponseAuthentication no

Greate guide, thanks!

Homero Valle Says:

30 October 2012 at 11:06 am.

Also, step 17 must be “ntsec”.

pathfinder Says:

30 October 2012 at 2:38 pm.

Thanks, yah I just re-installed last weekend and came across that but didn’t get around to updating it. I have fixed it now.

Leave a Reply

October 2014
M T W T F S S
« Jan    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Recent Posts

Advertisement