Centos SSH登陆慢解决

# 用root用户或者有管理员权限用户
sudo echo 'UseDNS  no'  >> /etc/ssh/sshd_config

# 查看下增加的配置 (可以不看) 去除了注释与空行

sudo cat /etc/ssh/sshd_config |grep -v '#' | grep -v '^$'


HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTHPRIV
AuthorizedKeysFile      .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials no
UsePAM yes
X11Forwarding yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem       sftp    /usr/libexec/openssh/sftp-server
UseDNS no

# 重启SSH服务
sudo systemctl restart sshd

因为反向验证DNS问题导致本地登陆可能需要10来秒,去掉以后秒登。

猜你喜欢

转载自blog.csdn.net/lansye/article/details/119825970