Slow SSH Logins on Linux
-
Often remote SSH logins on Linux can experience a lengthy delay. This is often caused by the SSH daemon on the server defaulting to attempting a DNS lookup of the SSH client attempting to connect to it. Typically we do not want this behaviour as client systems often cannot be verified in this manner but awaiting a DNS timeout can be rather annoying. Many systems configure this on by default. I see this in the Red Hat family including RHEL, CentOS, etc.
The fix is simple, just explicetly add the line:
UseDNS no
To the /etc/ssh/sshd_config configuration file. The default is “yes” and there should be a comment to this effect as well. After making the change, simply restart the SSH daemon for the change to take effect.
service sshd restart
Originally found in 2012 on my Linux blog here: http://web.archive.org/web/20140822224153/http://www.scottalanmiller.com/linux/2012/09/02/slow-ssh-logins/
-
@scottalanmiller said in Slow SSH Logins on Linux:
Often remote SSH logins on Linux can experience a lengthy delay. This is often caused by the SSH daemon on the server defaulting to attempting a DNS lookup of the SSH client attempting to connect to it. Typically we do not want this behaviour as client systems often cannot be verified in this manner but awaiting a DNS timeout can be rather annoying. Many systems configure this on by default. I see this in the Red Hat family including RHEL, CentOS, etc.
The fix is simple, just explicetly add the line:
UseDNS no
To the /etc/ssh/sshd_config configuration file. The default is “yes” and there should be a comment to this effect as well. After making the change, simply restart the SSH daemon for the change to take effect.
service sshd restart
Originally found in 2012 on my Linux blog here: http://web.archive.org/web/20140822224153/http://www.scottalanmiller.com/linux/2012/09/02/slow-ssh-logins/
Ran into this the other day. Windows to Linux was pretty slow, but Linux to Linux (using our Bind server) was super fast. Turned off DNS and GSSAPI and it was fine from Windows.