Slow SSH connections – hanging at GSSAPI auth
by bigpresh on Mar.29, 2011, under Linux, System Administration
A particular box at $work had been slow to SSH to for a while, and I finally wanted to spend the time to find out why.
Running ssh -v thatmachine showed that it was hanging whilst attempting to authenticate with GSSAPI, with the slow section looking like:
debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information Credentials cache file '/tmp/krb5cc_1000' not found debug1: Unspecified GSS failure. Minor code may provide more information Credentials cache file '/tmp/krb5cc_1000' not found debug1: Unspecified GSS failure. Minor code may provide more information debug1: Next authentication method: publickey debug1: Offering public key: /home/davidp/.ssh/id_rsa # authentication by public key then proceeded quickly
SSHing to the machine by IP instead, i.e. ssh -v 10.1.1.192, produced slightly different output:
debug1: Authentications that can continue: publickey,gssapi-with-mic,password 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 debug1: Next authentication method: publickey # authentication by public key then succeeded quickly
It’s clear that it’s trying to authenticate using GSS-API (Kerberos), failing, then moving on to public key auth.
The fix is simple – disable attempts to use GSS-API by adding the following to ~/.ssh/config:
GSSAPIAuthentication no
Before adding that:
[davidp@columbia:~]$ time ssh 10.1.1.192 touch /dev/null | grep real real 0m15.512s
After adding it:
[davidp@columbia:~]$ time ssh 10.1.1.192 touch /dev/null | grep real real 0m0.611s
Problem solved.
March 31st, 2011 on 2:20 am
Thanks a lot this save me lot of time lol.
July 18th, 2011 on 7:44 pm
Thanks!
This helped me out.
January 16th, 2012 on 12:15 pm
works.. thanks
March 31st, 2012 on 3:11 pm
I was searching for how to disable the GSSAPI! Thank you very much!
April 16th, 2012 on 12:28 pm
Thanks, this was very helpful for Ubuntu 11.10. ~/.ssh/config did not exist on U11.10, but I created it and it solved the problem. Thanks!