I've just set up an SSH server (OpenSSH) on a Windows 7 machine using cygwin and I'm trying to connect to it using PuTTY on a Windows Vista machine but I keep getting Connection timed out. I've checked the network activity on the Win 7 machine with Wireshark and found that I am receiving TCP SYN on port 22 on the Win 7 machine, but the ssh server doesn't seem to reply. I've checked the port number sshd is configured to use, checked my firewall rules and verified that I can ssh localhost (which I can just fine). I have absolutely no idea how to troubleshoot this problem.

  • You should probably check your firewall again, and/or elaborate on this aspect.
    – jjlin
    Jul 5, 2012 at 16:54

6 Answers 6


You may have Windows Firewall running. Open: Control Panel -> Windows Firewall -> Allow a program or feature through Windows Firewall

Click the "Change settings" button then the "Allow another program..." button. SSHD is probably not in the list that comes up, so use the "Browse..." button to find the binary and click "Open" and then "Add". Mine was in C:\cygwin\usr\sbin\sshd.exe

Somewhere in there you can decide which "Network location types..." you want to use. I left mine with Private checked and public unchecked. I can now login remotely.

  • Further to Frank's answer, when I installed a privacy VPN on a computer on my home network, I saw this same problem. It was because with the VPN the computer was now connecting with the sshd on a public network. To fix this I had to allow sshd through the Windows Firewall for public locations as well as private. Dec 28, 2015 at 17:26

Does your sshd_config specify ListenAddress as or

If it's or just commented out, then you can connect from outside the machine, ie, from another computer.

If it's (or any other 127.0.0.x number), then it's ONLY listening on the LOCALHOST, and you can only log in from the SAME machine. External machines are denied.

  • 2
    It's commented out.
    – Surma
    Jul 8, 2012 at 13:40

After messing around with windows firewall to no effect I eventually found I had to allow connections to my own subnet in Cygwin itself via the /etc/hosts.allow file.

This line (using my subnet) as the first rule fixed the issue for me.

ALL : : allow

  • 1
    A problem with hosts.allow or hosts.deny wouldn't cause a connection timeout. It would cause the SSH server to accept the connection, then drop it during the authentication process.
    – Kenster
    Jun 19, 2014 at 13:45
  • @Kenster hosts.allow and hosts.deny work at TCP level. You would not be able to connect to the SSH server because you get blocked at layer 4, before even reaching the SSH server.
    – mtak
    Jun 19, 2014 at 14:07
  • @mtak No, that's not true. hosts.allow and hosts.deny are configuration files for TCP Wrappers. The server program (sshd in this case) has to accept the TCP connection, get the remote endpoint's IP address, then call TCP wrappers to see if the client should be allowed. If libwrap says no, then the server typically drops the connection.
    – Kenster
    Jun 19, 2014 at 14:25
  • See eg sshd.c. Look for the LIBWRAP ifdefs. Here is the hosts_access function that sshd is calling. I'll also note that the most recent version of sshd.c removes libwrap support.
    – Kenster
    Jun 19, 2014 at 14:28
  • @Kenster, my bad, you are right. I tried it and I get the following error: ssh_exchange_identification: Connection closed by remote host. Good day on SU :)
    – mtak
    Jun 19, 2014 at 14:32

For me the issue was with incorrect ownership of the /var/empty file. The problem became obvious after putting sshd in debug mode with /usr/sbin/sshd.exe -D -dd. I had to correct it with:

chown [user]:[group] /var/empty

User and group were taken from the ls -la /var directory (just matched other files). See more info here: https://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC340

  • Thank you for pointing out sshd -D -dd
    – John Oxley
    Nov 3, 2016 at 13:51

Make sure you are win 7 Antivirus is not blocking port 22. Also, go to your windows service panel and search for CYGWINsshd and enable it. set logon to locate and check of the box.

That will fix the issue: user@mymachine ~ $ net start sshd System error 1069 has occurred.

The service did not start due to a logon failure.


I had a case where the permissions on the /home directory were bad. sshd in debug mode told me:

Authentication refused: bad ownership or modes for directory /home

The perms looked like:

drwxrwxrwt+  1 xxxxx None                0 Jul 15 12:41 home/

I changed them to:

drwxr-xr-x+  1 xxxxx None                0 Jul 15 12:41 home/

And it started working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.