Centos – SSH connection hangs but eventually connects

centosnetworkingssh

I have a CentOS 6.4 server sitting right next to me (same subnet and everything) and when I try to connect to it from another machine via SSH it hangs for about 10 seconds until finally prompting for a password. Any ideas what could be causing this?

I'm using the IP to access it so that rules DNS issues out. The machine is next to me on the same switch and subnet. I'm not using keys for authentication, just regular password authentication.

Best Answer

Are you sure you can rule out DNS issues? Often when similar symtoms occur, It may be that SSHD is doing a reverse-lookup of the connecting IP, but eventually fails after reaching a timeout.

Try setting in /etc/ssh/sshd.conf

UseDNS no

and reload sshd daemon and connect again.