Cygwin: start and enable sshd

root's picture

Ever wonder how to connect via ssh to a windows machine?
Of course there are other ways but I like this one better because it allows you to access the most powerful tool ever created for Windows: cygwin :)
So, here we go.

1. Run cygwin as administrator

Right click on the cygwin icon and select "Run as administrator".

2. Execute the command ssh-host-config:

Assuming this is the first time, you should answer yes to all questions.
Also, when prompted to "Enter the value of CYGWIN for the daemon", type 'ntsec'. This enables communication with the NT authentication database.

10:24:59 root@GAMEBOX:~$ 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: 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: [] ntsec

*** Info: The sshd service has been installed under the LocalSystem
*** Info: account (also known as SYSTEM). To start the service now, call
*** Info: `net start cygsshd' or `cygrunsrv -S cygsshd'.  Otherwise, it
*** Info: will start automatically after the next reboot.

*** Info: Host configuration finished. Have fun!

3. All you have to do now is to start the sshd service. You can do this via Services or via cygwin. Your choice. Below is via cygwin:

10:25:22 root@GAMEBOX:~$ net start cygsshd
The CYGWIN cygsshd service is starting.
The CYGWIN cygsshd service was started successfully.

Once ssh is started, you can try connecting to it from another machine

By the way, root is not root as you know it from *NIX, it is just my Windows username.
So, in order to connect via ssh to your newly cygwin sshd server, you will use your Windows username and password.

fmbpro:~ florian$ ssh root@GAMEBOX
root@GAMEBOX's password: 
Last login: Tue Apr  7 10:27:32 2020 from fmbpro
10:29:25 root@GAMEBOX:~$

Thou shalt not steal!

If you want to use this information on your own website, please remember: by doing copy/paste entirely it is always stealing and you should be ashamed of yourself! Have at least the decency to create your own text and comments and run the commands on your own servers and provide your output, not what I did!

Or at least link back to this website.

Recent content

root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root
root