Centos7使用时SSH登陆特别慢解决记录

903 阅读1分钟

前言

Centos7使用时SSH登陆特别慢解决记录

新安装的Centos7的linux服务器,测试能登陆,但发现ssh登陆极慢,较影响效率,可能是由于/etc/ssh/sshd_config中两个配置参数GSSAPIAuthentication和UseDNS影响的原因,修改配置后,登陆速度正常,记录如下。

备份sshd_config

cp /etc/ssh/sshd_config /etc/ssh/sshd_config_default

修改参数

GSSAPIAuthentication

将GSSAPIAuthentication yes修改成GSSAPIAuthentication no

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

UseDNS

将#UseDNS yes修改成UseDNS no

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

重启sshd服务

systemctl restart sshd

总结

ssh登陆慢,可能是由于两个配置参数GSSAPIAuthentication和UseDNS影响的原因,修改配置后,登陆速度正常,经过以上操作后,经测试ssh登陆连接很快。