I seem to be running into a problem when attempting to ssh. Here is my scenario;

Host A -
Host B -

From Host B, I am unable to ssh to Host A, as I get the error

"ssh: connect to host port 22: Connection timed out".

However, what is weird is that I am able to ssh to any other hosts from Host B to any host on the Host A subnet except for Host B's IP.

I ran the

"ssh -vvv Host A" from Host B

and then on Host A I ran the "netstat -nat |grep 22" this is the output as I see the sync_recv, but never gets established.

netstat -nat |grep 22
tcp        0      0    *               LISTEN
tcp        0      0      SYN_RECV
tcp        0      0      ESTABLISHED
tcp        0      0     ESTABLISHED
tcp6       0      0 :::22                   :::*                    LISTEN

Is there something that could be blocking it? I have firewall turned off on both ends.

  • please look in /var/log/auth.log (and other log files) on Host A. You may see a useful ssh error in there, usually something like "Illegal user" or "Failed password" or something similar. – ImaginaryRobots Jan 23 '13 at 20:46
  • Starting simple, can you ping the host you wish to access? – Alpy Feb 27 at 18:50

Sometimes you need to input the user if you have login as root disabled like this : User@

  • Olaf, Thanks for the response. However, even though i put int he user, i am still not able to connect. I ran a ssh -vv and it hangs here.. <pre> ssh -vv user@ OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010 debug1: Reading configuration data /etc/ssh/ssh_config debug1: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to [] port 22.</pre> – sohk220 Jan 23 '13 at 19:40
  • Hmm seems like there's no response from host. As far as i can tell of course. You could of course check if it hasn't crashed on the server but you probably did it already ;P Im going to think and if i come up with anything i'll post it here :) – Genesis Jan 23 '13 at 20:09
  • Olaf,Thanks as I have been troubleshooting this for the past two days and can't seem to figure it out. I also did nmap and it shows port 22 opened. – sohk220 Jan 23 '13 at 20:12
  • This is on the other end when I run netstat while attempting to ssh. tcp 0 0 SYN_RECV – sohk220 Jan 23 '13 at 20:20
  • When the error is "Connection timed out," the SSH server is never seeing the login attempt, so it's not due to a wrong username (or password). – Eliah Kagan Jan 24 '13 at 0:59

Try the following:

  • Ping the server to see if you get any response.
  • Make sure you have installed sudo apt install openssh-server on the server side.
  • Try editing /etc/ssh/ssh_config and make sure you have:

    • PasswordAuthentication yes
    • Try selecting a different port, other than Port 22, then try ssh -p <port> <user>@<server>
    • Enable the port on your firewall sudo ufw allow <port>

    • You need to restart ssh after the changes sudo systemctl restart ssh

  • Make sure again that ssh is enabled in the firewall sudo ufw allow ssh

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.