The SSH server, sshd, runs under Cygwin as a standard Windows service, called (not surprisingly) Cygwin SSH Service. Cygwin provides a script, called ssh-host-config, to set this up. Here’s what to do:
The Cygwin SSH Service (a.k.a. sshd) runs only on flavors of Windows that support services: NT, 2000, XP, 2003, etc.
Make sure you’ve set up the path and environment variables for OpenSSH and Cygwin. [14.1]
From an account with administrative privileges, run:
C:\> ssh-host-config
Answer yes to all questions.
When ssh-host-config completes, your service should be ready to run. Open your Services control panel, look for Cygwin SSHD Service, and start the service. Alternatively, use the command line:
C:\> net start sshd
You might also want to set the service startup to Automatic, so it runs whenever you boot the computer. To stop the service, again use the Services control panel or type:
C:\> net stop sshd
If the service refuses to run, here are some things to try:
Make sure the file /var/log/sshd.log is writable by the
SYSTEM account.
Read /var/log/sshd.log for error messages.
To test the server, connect to yourself:
C:\> ssh localhost
You should be prompted for your password and be able to log in.
Serverwide configuration files are found in /etc, such as /etc/sshd_config. This is in contrast to Unix-like systems that usually keep these files in /etc/ssh.
If you want to run graphical applications via ssh that open windows, such as notepad or regedit:
C:\> ssh my-pc-name notepad
this will not work unless you grant sshd permission to do so. Here’s how to do it on Windows XP and 2000:
Open the Services control panel.
Stop the Cygwin sshd service.
Double-click the Cygwin sshd service to view its properties.
Select the Log On tab.
Under “Log on as,” select the Local System account and check the box “Allow service to interact with desktop.”
Click OK and restart the Cygwin sshd service.
Before doing this, however, carefully consider the security implications. You’re permitting any user with SSH privileges—not just the logged-in user, not just administrators—to open windows on the desktop remotely.