You can either alter the parameters of your currently installed server to enable debugging or install another that has the debug parameters. I prefer the latter since that doesn't overwrite the normal sshd service. If you check out '/usr/bin/ssh-host-config', there's a line in there with 'cygrunsrv -I' that you'll want to replicate and modify for your needs if you want to set up a new service. Something like this should work though, assuming you've already run '/usr/bin/ssh-host-config' before to set up the normal sshd service. /usr/bin/cygrunsrv -I sshd -d "CYGWIN sshd_debug" -p /usr/sbin/sshd -a "-D -d -d -d" -y tcpip The service starts automatically. You'll have to manage which one (the normal or the debug) that you want started automatically, depending on you need. You don't want both the debug and normal sshd services to be running at the same time. Keep in mind that the debug service terminates after the first connection ends.
If you are debugging a SSH connection, you may need to run sshd by hand (instead of as a service) and enable debugging output. Doing so allows you to track exactly why a connection is failing to establish. However, if you try to run sshd by hand, you may get the following message.
% cygrunsrv.exe --stop sshd
% /usr/sbin/sshd.exe -D
Could not load host key: /etc/ssh_host_ecdsa_key
/var/empty must be owned by root and not group or world-writable.
To fix this, make the user starting the sshd service the owner of /var/empty.
% ls -ld /var/empty
drwxr-xr-x+ 1 cyg_server root 0 May 7 2010 empty
% chown <user> /var/empty
Now, start sshd again.
% /usr/sbin/sshd.exe -D
When you are done debugging and are ready to run sshd again as a service, change the owner of /var/empty to cyg_server.
% chown cyg_server /var/empty
% cygrunsrv.exe --start sshd
Note: you must have administrator privileges to run cygrunsrv.exe.