Centos - Fix slow ssh login

Introduction

If you've noticed that it takes a significant amount of time to recieve the login prompt when using SSH to access a CentOS server, you can follow the steps below to make it immediate.

Please note that testing/development of this material was done with a minimal net install of Centos 6.3

Solution

    Edit the
    /etc/ssh/sshd_config
    file and change GSSAPIAuthentication yes to GSSAPIAuthentication no
    Also change UseDNS to explicitly no by running the following commands/script.
    SEARCH="#UseDNS yes"
    REPLACE="UseDNS no"
    FILEPATH="/etc/ssh/sshd_config"
    sed -i "s;$SEARCH;$REPLACE;" $FILEPATH
    Then restart the ssh daemon for it to take effect:
    sudo service sshd restart
    That was it! Now you can exit your ssh connection before relogging in and you will notice that you get an immediate request for your password.

References

Delayed SSH login on Centos 6

No comments:

Post a Comment