Fix Slow SSH Logins


Often, when trying to ssh into Linux boxes, it can take over 30 seconds to log in or even see the login prompt. This is annoying (especially when running automated scripts) but solvable.

The problem is normally caused by one of two things: your SSH client is using GSSAPI authentication or the remote server is doing reverse DNS lookups.

GSSAPI authentication is an alternative to using passwords or SSH keys to log in. Most people don’t need to use it, and if you’re one of these people, you can safely turn it off. Open up the SSH config file (normally /etc/sshd/ssh_config, not to be confused with sshd_config which is for the SSH daemon) and either modify or add the following:

GSSAPIAuthentication off

Next time you try to log into a remote server, your ssh client should get to the login prompt a lot quicker. If it still doesn’t, then try the following: log onto the remote server, edit sshd_config and check if UseDNS is set. If so, change it to:

UseDNS no

Next, restart the SSH daemon and your logins to that box should be quick again.

Next Post
Caching Proxies - the Cheap Way to Handle Lots of Traffic

Previous Post
Generate SSH Keys

comments powered by Disqus