SSH session slow to start?

Ever tried logging into a machine with ssh and found you have to wait much longer than reasonable for the session to start? This happened to me a few times and was especially annoying with machines on my local network (or a VM attached to a virtual network) that should be letting me in immediately.

I eventually got mad enough to strace the SSH daemon and debug what was going on and it turns out it’s a DNS thing. Basically the session is slow to start because the SSH server is trying to lookup the hostname of the SSH client and for whatever reason it’s timing out (e.g., it can’t reach a nameserver, because you happen to be offline)

There are a couple of very simple ways to fix that:

add “UseDNS no” to /etc/ssh/sshd_config
add the client’s net address to the server’s /etc/hosts

Credit and many thanks to: Liraz Siri
http://www.turnkeylinux.org/blog/slow-ssh

SSH session slow to start?

3 thoughts on “SSH session slow to start?

  1. I actually blog likewise and I’m composing a little something comparable to this
    specific blog, “SSH session slow to start? Buffer of My Mind”.

    Do you care in the event I personallyimplement a number of of your
    own suggestions? I appreciate it ,Fidel

Leave a Reply

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