Step 1: download Cygwin at http://www.cygwin.com/
For Windows 32bits: http://www.cygwin.com/setup-x86.exe
For Windows 64bits: http://www.cygwin.com/setup-x86_64.exe
Step 2: Install Cygwin
(Recommended: http://cygwin.mirrors.hoobly.com/)
Find AutoSSH, OpenSSH OpenSSL Zip Unzip
Step 3: Open Cygwin terminal
To verify if Cygwin (cygrunsrv) is installed properly, run the following command:
cygrunsrv -h
It means you install Cygwin successfully!! Otherwise, you must re-install it.
Step 4: configure the SSHD service
Run the command:
ssh-host-config
Result:
$ ssh-host-config *** Info: Generating missing SSH host keys ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 *** Info: Creating default /etc/ssh_config file *** Info: Creating default /etc/sshd_config file *** Info: StrictModes is set to 'yes' by default. *** Info: This is the recommended setting, but it requires that the POSIX *** Info: permissions of the user's home directory, the user's .ssh *** Info: directory, and the user's ssh key files are tight so that *** Info: only the user has write permissions. *** Info: On the other hand, StrictModes don't work well with default *** Info: Windows permissions of a home directory mounted with the *** Info: 'noacl' option, and they don't work at all if the home *** Info: directory is on a FAT or FAT32 partition. *** Query: Should StrictModes be used? (yes/no) yes *** Info: Privilege separation is set to 'sandbox' by default since *** Info: OpenSSH 6.1. This is unsupported by Cygwin and has to be set *** Info: to 'yes' or 'no'. *** Info: However, using privilege separation requires a non-privileged account *** Info: called 'sshd'. *** Info: For more info on privilege separation read /usr/share/doc/openssh/READ ME.privsep. *** Query: Should privilege separation be used? (yes/no) yes *** Info: Note that creating a new user requires that the current account have *** Info: Administrator privileges. Should this script attempt to create a *** Query: new local account 'sshd'? (yes/no) yes *** Info: Updating /etc/sshd_config file *** Query: Do you want to install sshd as a service? *** Query: (Say "no" if it is already installed as a service) (yes/no) yes *** Query: Enter the value of CYGWIN for the daemon: [] binmode ntsec *** Info: On Windows Server 2003, Windows Vista, and above, the *** Info: SYSTEM account cannot setuid to other users -- a capability *** Info: sshd requires. You need to have or to create a privileged *** Info: account. This script will help you do so. *** Info: It's not possible to use the LocalSystem account for services *** Info: that can change the user id without an explicit password *** Info: (such as passwordless logins [e.g. public key authentication] *** Info: via sshd) when having to create the user token from scratch. *** Info: For more information on this requirement, see *** Info: https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1 *** Info: If you want to enable that functionality, it's required to create *** Info: a new account with special privileges (unless such an account *** Info: already exists). This account is then used to run these special *** Info: servers. *** Info: Note that creating a new user requires that the current account *** Info: have Administrator privileges itself. *** Info: No privileged account could be found. *** Info: This script plans to use 'cyg_server'. *** Info: 'cyg_server' will only be used by registered services. *** Query: Do you want to use a different name? (yes/no) no *** Query: Create new privileged user account 'MRNC-N9NJM89QFO\cyg_server' (Cygw in name: 'cyg_server')? (yes/no) yes *** Info: Please enter a password for new user cyg_server. Please be sure *** Info: that this password matches the password rules given on your system. *** Info: Entering no password will exit the configuration. *** Query: Please enter the password: *** Query: Reenter: *** Info: User 'cyg_server' has been created with password '*************'. *** Info: If you change the password, please remember also to change the *** Info: password for the installed services which use (or will soon use) *** Info: the 'cyg_server' account. *** Info: The sshd service has been installed under the 'cyg_server' *** Info: account. To start the service now, call `net start sshd' or *** Info: `cygrunsrv -S sshd'. Otherwise, it will start automatically *** Info: after the next reboot. *** Info: Host configuration finished. Have fun!
Step 5: start the SSH daemon
net start cygsshd
or
cygrunsrv -S sshd
Result:
$ net start cygsshd The CYGWIN cygsshd service is starting. The CYGWIN cygsshd service was started successfully.
Get status from windows server
cygrunsrv --query sshd
Result:
$ cygrunsrv --query sshd Service : sshd Display name : CYGWIN sshd Current State : Running Controls Accepted : Stop Command : /usr/sbin/sshd -D
Remove windows service
cygrunsrv --remove sshd
Note: Some error, so you should use net start cygsshd
$ cygrunsrv -S sshd cygrunsrv: Error starting a service: OpenService: Win32 error 1060: The specified service does not exist as an installed service.
4 Comments
How to create SSH tunnel on Windows by using AutoSSH | Free Online Tutorials
(May 21, 2016 - 2:57 pm)[…] Follow step 1,2,3 in this tutorial: How to install SSH daemon on Windows […]
How to use SSH as a proxy | Free Online Tutorials
(May 22, 2016 - 9:48 am)[…] Read step 1,2,3 in this tutorial: How to install SSH daemon on Windows […]
How to run a https website with Nodejs, express and socket.io | Free Online Tutorials
(November 11, 2017 - 5:53 am)[…] Step 1: generate RSA key Use command line: (on Windows we can use Cygwin) […]
Windows: how to install tesseract | Free Online Tutorials
(June 16, 2022 - 8:45 am)[…] Read this article: http://tutorialspots.com/how-to-install-ssh-daemon-on-windows-2954.html […]