Googled this to death, cannot resolve. I cannot connect to my CYGWIN sshd from another machine. Netstat shows connection is established. Can connect locally, no problem.

[[email protected] ~]$  ssh [email protected]
ssh: connect to host mycomp port 22: Connection refused

On mycomp:

$ netstat -a | grep ssh
  TCP    MYCOMP:ssh            MYCOMP.mydomain.com:0  LISTENING
  TCP    MYCOMP:1161           aserver.mydomain.com:ssh  ESTABLISHED

Successful login from the localhost:

$ ssh [email protected]
[email protected]'s password:
Last login: Tue Sep 14 14:27:30 2010 from mycomp.mydomain.com
Fanfare!!!
You are successfully logged in to this server!!!

I’m on XP sp3, updated CYGWIN today. Tried cleanup and reconfigure, didn’t help.

Cleanup (credit to Herb Maeder http://www.cygwin.com/ml/cygwin/2008-10/msg00370.html) :

# 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 relaged users (such as cyg_server) from the system
net user sshd /delete

Configure:

$ ssh-host-config -y
*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
*** Info: Creating default /etc/ssh_config file
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/README.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges.  Should this script attempt to create a
*** Query: new local account 'sshd'? (yes/no) yes
*** Info: Updating /etc/sshd_config file
*** Query: Overwrite existing /etc/inetd.d/sshd-inetd file? (yes/no) yes
*** Info: Creating default /etc/inetd.d/sshd-inetd file
*** Info: Updated /etc/inetd.d/sshd-inetd


*** Warning: The following functions require administrator privileges!

*** 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: []

*** 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 sshd' or `cygrunsrv -S sshd'.  Otherwise, it
*** Info: will start automatically after the next reboot.

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

[email protected] /cygdrive/c/Documents and Settings/myid
$ cygrunsrv -S sshd

[email protected] /cygdrive/c/Documents and Settings/myid
$ cygrunsrv -Q sshd
Service             : sshd
Display name        : CYGWIN sshd
Current State       : Running
Controls Accepted   : Stop
Command             : /usr/sbin/sshd -D

Leave a Reply

Your email address will not be published. Required fields are marked *