Slow SSH Login in Debian / Ubuntu Linux

Generally speaking, even the password prompt should not take a lot of time (more than a few seconds) to pop up during the initial connection state. However, leaving parts of the SSH daemon unconfigured can lead to communication mismatch and timeout troubles under the hood – luckily, two lines of configuration editing will solve this issues for us.

Please note: I’m assuming that you are not using GSSAPI authentication (by default if you do not know what it is, then it is safe to assume that you are not using it – more on that on this Wiki page).

The other function we are going to disable is the Reverse DNS lookup  function which only serves as an added logging feature.

Under Ubuntu, the default config file for sshd is located here:

/etc/ssh/sshd_config

So, editing the GSSAPI line lines like this:

GSSAPIAuthentication no

And adding (if it not exist) this:

UseDNS no

We should be logging in as swiftly as ever!