How to uninstall/reinstall cygwin to use the sshd?

If sshd has been previously installed on the system, the following cleanup procedure should be performed before invoking ssh-host-config:

# Remove sshd service
cygrunsrv --stop sshd
cygrunsrv --remove sshd

# Delete any sshd or related users (such as cyg_server) from /etc/passwd
#   (use your favorite editor)

# Delete any sshd or related users (such as cyg_server) from the system
net user sshd /delete
net user cyg_server /delete

I had to do three steps to make it reinstalled.

  • delete LOCAL_MACHINE\SYSTEM\ControlSet001\services\sshd
  • run 'sc delete sshd'
  • reboot

The problem is that I can't login the cygwin from the Mac, which is the exact reason I tried to reinstall the cygwin.

I made another thread about this problem. -> I can't login cygwin/ssh from Mac