ssh登录缓慢,使用ssh -v登录后,显示在 “pledge: network” 处卡顿:

当登录一台服务器时,每次输入密码之后都要等很久才会得到命令提示符,尝试修改了sshd_config中的UseDNS no,但效果依然不好。

ssh -v 192.168.12.43

This is probably an issue with D-Bus and systemd. If the dbus service is restarted for some reason, you will also need to restart systemd-logind.
You can check if this is the issue by opening the ssh daemon log (on Ubuntu it should be /var/log/auth.log) and check if it has these lines:
注:CentOS 下查看 

 
cat /var/log/secure

sshd[2721]: pam_systemd(sshd:session): Failed to create session: Connection timed out
如果找到以上信息,则在服务端执行:

systemctl restart systemd-logind
 
完美解决!!
posted @ 2019-10-12 16:02  wooya  阅读(2789)  评论(0编辑  收藏  举报