Reduce SSH connection time to remote servers

Sometimes the ssh to remote server may take a long time to connect. This is because the ssh config tries to authenticate with GSSAPI which may be enabled in the server.

Doublecheck if that is the case using the -v option : ssh -v
If you get this particular line on the screen,
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
where gssapi-with-mic is mentioned, then GSSAPI is enabled.

To reduce the time and workaround this problem, create a config file at ~/.ssh (in your home folder). Call the file config.
Add the following credentials.

Host (Put the name of the host here)
GSSAPIAuthentication no
PasswordAuthentication yes
ChallengeResponseAuthentication no
ForwardX11 yes

You should be sorted after this.
If you do get an error , your ssh may not have been compiled with GSSAPIAuthentication ( which is the case in Ubuntu 10.04) . Unless you want to recompile your ssh with extra options, you should be probably talking to the system admin of the server to disable the authentication or other workarounds.

Sayantan Das

Sayantan is a DevOps Consultant by the day and works mainly with Ansible and Linux . He is a AWS - SA and RedHat Certified Engineer . He loves to tinker with Linux systems .

Leave a Reply

Close Menu
%d bloggers like this: