Friday, February 22, 2013

SSH taking too long to connect

When I tried to SSH to a machine, it was taking too long to connect.

So from the client, tried the ssh -v option to check where the connection was hanging and found the following

# ssh -v 192.168.1.33
.......
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
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: An invalid name was supplied


So gssappi authentication was causing the delay in getting the login prompt.

How to overcome the GSSAPI authentication?

1) Disable GSSAPI authentication when using SSH or SCP command as follows

         ssh -o GSSAPIAuthentication=no 192.168.1.33


2) Disable GSSAPI authentication in ssh client configuration file. Add the line

        GSSAPIAuthentication  no

in /etc/ssh/ssh_config file (global ssh client configuration file) (OR)
in /home/<user>/.ssh/config file (Per user configuration file)


3) Adding the IP of the server to which we are connecting to in /etc/hosts file of client machine, like follows

        192.168.1.33  dhcppc1
  

No comments:

Post a Comment