assuming: you have cygwin installed already, plus the requisite packages.
It took me less than twenty minutes (well, I had to perform some due diligence, even though I had done it before on another system. And the windows firewall issue).
All commands should be run in a bash shell unless directed otherwise.
- Check that you have cygrunsrv. The brute force method:
$ cygrunsrv.exe -S sshd
cygrunsrv: Error starting a service: OpenService: Win32 error 1060:
The specified service does not exist as an installed service.
If you get 'command not found', then you'll need to install the package.
- run ssh-host-config
seemed to take a minute or so before I got any output, but maybe that's because my virtual machine didn't have much entropy for key generation.
type 'yes' a couple times at the prompts, unless you don't want to.
- now install as a service:
cygrunsrv.exe -S sshd
when asked for value of CYGWIN, you can give:
binmode tty ntsec
- start the service.. run services.msc (from a cmd window) or use 'net start'
Test from bash with 'ssh -v username@localhost'.
Now, test externally with 'ssh -v username@cygwinSshHost' .. if you don't see any output, windows firewall or other form of bandaid is keeping you out.
After you're logged in, do 'ssh-add -L >> ~/.ssh/authorized_keys2' so you don't need to type passwords to log in anymore (maybe on the second login, agent forwarding doesn't happen on a new host ?).
More steps, with more detail: How to configure cygwin for sshd .