I’ve setup several CentOS 6 virtual machines recently and they all have the same delayed SSH login problem. I’ve found a solution to this problem and I’m documenting it here so I can find it next time!
I originally found this fix at http://www.walkernews.net/2009/04/06/how-to-fix-scp-and-ssh-login-prompt-is-very-slow-in-linux/ and it’s not specific to CentOS 6, but I’ve only observed this delay problem on CentOS 6.
Now, on to the problem. SSH logins to these CentOS 6 servers were delayed by about 30 seconds. (I never timed it exactly, but it was long enough to be very frustrating when you’re trying to get work done) 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
SSH logins should now be quick as usual!
there’s no delayed problem, it’s more like strong security.
your tutorial it’s almost good, it’s just that it needs one more thing.
You have to modify: “UseDNS yes” to “UseDNS no” and that’s it.
cheers mate
icuenvme, you’re wrong. I tried disabling dns lookups first, that didn’t work. Disabling GSS did the trick. Thanks, Nathan!
thanks nathan, I was getting desperate!
You are a scholar and a saint! Perfect fix!!
Well, only the “UseDNS yes” setting worked for me.
Thanks for the tip.
cm, you’re wrong. I tried disabling GSS and it did nothing. I switched it back on and disabled UseDNS, which did the trick. Thanks, icuenvme (and Nathan for original post)