preface

SSH login is extremely slow when Centos7 is used

The newly installed Linux server of Centos7 can be logged in, but it is found that SSH login is very slow, which affects the efficiency. This may be due to the influence of two configuration parameters GSSAPIAuthentication and UseDNS in /etc/ssh/sshd_config. Landing speed normal, recorded below.

Backup the sshd_config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config_default
Copy the code

Modify the parameters

GSSAPIAuthentication

Change GSSAPIAuthentication Yes to GSSAPIAuthentication No

sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
Copy the code

UseDNS

Change #UseDNS yes to UseDNS no

sed -i 's/^#UseDNS yes$/UseDNS no/' /etc/ssh/sshd_config
Copy the code

Restart the SSHD service

systemctl restart sshd
Copy the code

conclusion

SSH login is slow, which may be caused by the influence of two configuration parameters GSSAPIAuthentication and UseDNS. After the configuration is modified, the login speed is normal. After the preceding operations, SSH login is fast.