Problem: When I’m trying to log into the remote server via SSH, after I enter the UserName, it takes a lot of time before it displays the Password prompt. How to solve this problem?
Solution: Basically, a long delay during authentication process is caused by “GSS API Authentication method” or/and by “UseDNS” option. The solution is to disable the
GSSAPIAuthentication method and to set the
UseDNS to “no” on the SSH Server.
Edit SSH Server configuration file:
# vi /etc/ssh/sshd_config
UseDNS: Specifies whether sshd should look up the remote host name and check that the resolved host name for the remote IP address maps back to the very same IP address. The default is “yes”.
Set the UseDNS to “no” as shown below:
GSSAPIAuthentication: Specifies whether user authentication based on GSSAPI is allowed. The default is “no”.
Set the GSSAPIAuthentication to “no”:
Restart the OpenSSH server to apply changes
For Fedora/Centos/RHEL etc.:
# service sshd restart
For Debian/Ubuntu/LinuxMint etc.:
# sudo service ssh restart
Now you could connect to your Server with SSH quick as usual.