From my laptop I'm trying to connect to HOST1 and I get:

$ ssh -vvv user@HOST1
OpenSSH_6.0p1 Debian-3ubuntu1, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to HOST1 [x.x.x.x] port 22.
ssh: connect to host HOST1 port 22: Connection timed out

The ssh daemon on the server is working fine as I'm able to connect to it from other machine.
For instance from my laptop I'm able to ssh into HOST2 and from there I'm able to ssh into HOST1 but it's annoying.

HOST1 is some host I have control of, but it's happening also with github and bitbucket.

This lead me to believe the problem is client side only, but I ran out of ideas.

Any suggestion?

2 Answers 2


The problem may be that these servers are trying to authenticate your client machine in a way that is optional (so you can eventually log in) but where finding out where the method is available times out.

A common case is when the server tries a reverse DNS lookup on the client. Try disabling it on HOST: add UseDNS No to the sshd_config file. This option is on by default but mostly useless. It can lead to timeouts, but usually only of a few seconds. See What is the point of sshd “UseDNS” option?

Another less common but more annoying culprit is GSSAPI (Kerberos). Again, try turning it off. See How to speed my too-slow ssh login?


It might be a firewall in the way which just DROPs ICMP "not reachable" responses, or filters out SSH traffic. The "connection timed out" means just that: A request to connect was sent, but never got any kind of answer back.

Use tcpdump(1) and/or wireshark (at both ends of the intended connection, if need be) to check, and zero in on the filterer. Perhaps tcpping(1) can help narrowing it down.

  • I'm not excluding the firewall option, but would it make sense I can ssh into HOST2 behind the same firewall? Could you elaborate more what you're trying to test and what you mean with "zero in on the filterer"? Thanks! Mar 12, 2013 at 14:01
  • 1
    @AndreaAmbu, a firewall separating A from B and C can very well let all traffic from A to B through, and filter traffic between A and C. Most operating systems have local firewalls this day, so B could filter traffic from C but not from A. You'd have to check the whole path from beginning to end.
    – vonbrand
    Mar 12, 2013 at 15:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .