Slow SSH Logins on CentOS 5
Following any of the usual how-to’s didn’t leave me with a successfully speedy login.. I eventually tracked down the problem to a particularly monumental bug in RedHat’s OpenSSH server (apparently fixed up stream.. it does us all now no good)..
The fix
- edit
/etc/ssh/sshd_config - Find and change the lines (or add if missing):
GSSAPIAuthentication yes
...
#UseDNS yesto
GSSAPIAuthentication no
...
UseDNS no - Enjoy
Side Note
If you use CentOS you’re probably unable to reboot your SSH server and you don’t know it.
I also experienced this problem while attempting to restart the ssh server. Everything seemed to work but when checking the logs it showed serious errors. It complained about being unable to bind to port 22. To see if you have the same problem follow these steps..
tail /var/log/secure
If you find something like the following:
sshd[20213]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
then you’ve got problems.. It’s basically saying that the localhost IPv6 address (represented as “::”) is hogging port 22 instead of 0.0.0.0 (means ANY IPv4 address). If that’s what you want, then great! If not..
edit
and change it to look as follows from
#ListenAddress ::
to
#ListenAddress ::
Hope this helps!
References