Skip to content

sshd Delayed Connection

22/08/2011

I had for a long time a serious problem with my SSH server on one of my machines. It used to respond to the connection requests very slowly, usually after passing 20-30 seconds. This was very annoying, since it delayed my workflow, and also, because only one of my machines that run the SSH server had this behavior.

After searching around the Internet, I was lucky this week and found the correct answer on this problem. Many suggested various tricks and customizations, but the problem was very simple indeed.

It had to do with the so-called “Reverse DNS Lookup” (or something similar). In few words, sshd tries to look up the remote host name and check that the resolved host name maps back to the very same IP address. It is a security feature, yet slows down the operation of the server.

This is a default action for newer versions of sshd (and that’s the reason older machines haven’t this behavior) and the problem is that it isn’t mentioned in the appropriate config file. So, adding the line

UseDNS no

in the /etc/ssh/sshd_config file solves the very annoying problem.

So simple!

Advertisements
Leave a Comment

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: