• 1-888-289-2246
  • 24x7x365 Presence

Slow password prompt while making an SSH connection?


We’ve seen many times that when someone is trying to make an SSH connection to a server or a Linux machine there is a delay of some seconds or maybe even a minute after inputting the username, root or something else.

The actual reason behind this is that the system is looking up the hostname and the delay lasts as long as it is unable to resolve the hostname.

So to get rid of the lag, there is an option in SSH configuration using which we can stop the SSH daemon from dealing with the hostname resolution and by which we will be able to quickly view the password prompt. That option follows:

vi /etc/ssh/sshd_config

Find what’s below in the sshd_config file:

#UseDNS yes

Uncomment the line above and change it to:

UseDNS no

Now save the sshd_config file with the change. Restart the SSHD service as below:

/etc/init.d/sshd restart

After this, you need to attempt again to make an SSH session and you won’t face the slowness issue.

Another way is that instead of stopping the process of hostname resolution, make your server’s hostname correct and make the entry in the /etc/hosts file and then the daemon will look up the hostname quickly.

That’s all.

]]>