解决centos ssh登录缓慢问题

post by rocdk890 / 2017-4-27 13:59 Thursday linux技术
  最近在阿里云上新建了个系统镜像,但建了之后居然出现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/
夜空- 本站版权
1、本站所有主题由该文章作者发表,该文章作者与夜空享有文章相关版权
2、其他单位或个人使用、转载或引用本文时必须同时征得该文章作者和夜空的同意
3、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责
4、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意
5、原文链接:blog.slogra.com/post-697.html

标签: centos ssh 登录 缓慢 login logind 阿里云

评论: