Tuesday, February 17, 2015

debug2: ssh_connect: needpriv 0 stuck - Fix.

Sometimes we face issues with SSH while connecting which is due to couple of default parameters. We can determine the delay by executing ssh command with -vv option

ssh -vv myhost
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /home/user/.ssh/config
debug2: ssh_connect: needpriv 0


1) The first, and largest cause of delays, is client and the server working to authenticate me using 'GSSAPI' (Kerberos) authentication. That seemed to be a good 15-18 seconds of the delay. To fix this problem add the following configuration file for my user that disabled GSSAPI authentication for the host.

File : /etc/ssh/ssh_config

Host *
    GSSAPIAuthentication no
    GSSAPIKeyExchange no

2) In case if we have IPv4 and IPv6 channels then above configuration wont help in the ssh delay so in that case we need to add one more line to the above configuration.

File : /etc/ssh/ssh_config

Host *
    GSSAPIAuthentication no
    GSSAPIKeyExchange no
    AddressFamily inet
In both the cases we are specifying the configuration for all the hosts we are using *, We can do it same for specific hosts.

 Instead of

Host *
Use
Host myhost-mydomain.com

File /etc/ssh/ssh_config is global configuration which is for all the users, We can do the same for individual users by specifying the same parameters in ~/.ssh/config file.