If SSH login is very slow in CentOS 6 it’s because they have added another security feature, the SSH server will do a reverse DNS again for any incoming connection, this will delay connection up to 13 seconds, to avoid this:

 

  1. Access the server
  2. Edit the ssh config
    nano /etc/ssh/sshd_config
  3. Look for use dns and change it to no
    Ctrl +w, usedns, enter

    Change it from

    #useDNS yes

    to

    useDNS no

  4. Save and close
    Ctrl + X, Y, enter
  5. Restart the sshd service

 

Also

 

When logging in using ssh -vvv user@hostname the debug output shows the delay happens at these lines:

 

debug3: authmethod_is_enabled gssapi-with-mic

debug1: Next authentication method: gssapi-with-mic

debug1: An invalid name was supplied

Cannot determine realm for numeric host address

 

debug1: An invalid name was supplied

Cannot determine realm for numeric host address

 

debug1: An invalid name was supplied

 

The solution appears to be disabling the GSS API authentication method on the SSH server.

 

To disable GSS API, first open/etc/ssh/sshd_config in your favorite editor

vim /etc/ssh/sshd_config

Then find the line that says

GSSAPIAuthentication yes

Change it to

GSSAPIAuthentication no

and save the file. Finally, restart the sshd service.

service sshd restart

This page has been readed 1849 times

Leave a Reply

Your email address will not be published. Required fields are marked *