Slow SSH Login | UseDNS=no

Problem: When SSH’ing into a server, connection, and login take a long time.

  1. Connect to a server
  2. Attempt to log in, and wait to see how long the connection takes.
    1. 10+ seconds is too long and should be investigated.

Screen Shot 2017-11-07 at 11.11.19 AM

  1. Wait for the password prompt and then proceed to  cat /etc/ssh/sshd_config | less

Screen Shot 2017-11-07 at 11.25.20 AM

  1. use vi to edit the sshd_config file.
    1. If you are still in the root directory, then you will need to use the following path vi /etc/ssh/sshd_config
  2. Once in, go straight to the bottom of the config file.
  3. Once at the bottem you will need to add the following, “UseDNS no”
  4. Save and Exit Vi editor
  5. Now, restart ssh with the following command  systemctl restart sshd
    1. Then check the status of SSHD with “systemctl status sshd”
      Screen Shot 2017-11-07 at 11.29.54 AM
  6. Once done, exit and try to reconnect to the server. See if disabling DNS solved the issue.  What UseDNS does: UseDNS – Determines whether IP Address to Hostname lookup and comparison is performed.

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s