解决centos ssh登录缓慢问题
最近在阿里云上新建了个系统镜像,但建了之后居然出现ssh连接缓慢的问题,看了配置文件里的UseDNS和GSSAPIAuthentication这2个参数都是no,还是连接ssh缓慢,使用ssh -v root@ip也没有找到问题,最后查看系统日志/var/log/messages发现下面错误:
Apr 27 11:36:58 qx120 dbus[10109]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' Apr 27 11:36:58 qx120 dbus-daemon: dbus[10109]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' Apr 27 11:37:23 qx120 dbus[10109]: [system] Failed to activate service 'org.freedesktop.login1': timed out Apr 27 11:37:23 qx120 dbus-daemon: dbus[10109]: [system] Failed to activate service 'org.freedesktop.login1': timed out Apr 27 11:39:17 qx120 dbus[10109]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' Apr 27 11:39:17 qx120 dbus-daemon: dbus[10109]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' Apr 27 11:39:42 qx120 dbus[10109]: [system] Failed to activate service 'org.freedesktop.login1': timed out Apr 27 11:39:42 qx120 dbus-daemon: dbus[10109]: [system] Failed to activate service 'org.freedesktop.login1': timed out Apr 27 11:40:01 qx120 dbus[10109]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' Apr 27 11:40:01 qx120 dbus-daemon: dbus[10109]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' Apr 27 11:40:26 qx120 dbus[10109]: [system] Failed to activate service 'org.freedesktop.login1': timed out Apr 27 11:40:26 qx120 dbus-daemon: dbus[10109]: [system] Failed to activate service 'org.freedesktop.login1': timed out
网上搜了下,说systemctl status systemd-logind (centos6使用service systemd-logind status) 查看systemd-logind状态,如下图
解决办法:
systemctl restart systemd-logind
centos6使用:
service systemd-logind restart
重启好了systemd-logind服务后,再次重新连接ssh,发现问题解决.
ps:
https://serverfault.com/questions/707377/slow-ssh-login-activation-of-org-freedesktop-login1-timed-out
https://major.io/2015/07/27/very-slow-ssh-logins-on-fedora-22/
评论: