频道栏目
首页 > 资讯 > Linux > 正文

centOS ssh登录缓慢解决

17-08-01        来源:[db:作者]  
收藏   我要投稿

centOS ssh登录缓慢

有一台执行机使用ssh登录很慢,输入完密码后需要等待2,30秒才能够登录进去,简直不能忍.查看日志发现卡在Entering interactive session

网上解决办法:

修改本机的 /etc/ssh/sshd_config
添加  UseDNS no
修改目标机器的 /etc/ssh/ssh_config
添加 GSSAPIAuthentication no

并没有什么作用

使用ssh -v user@192.168.1.1排查发现

ssh -v 80@30.35.108.5

OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 192.168.1.1 [192.168.1.1] port 22.
debug1: Connection established.
debug1: identity file /Users/liudan/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liudan/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liudan/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liudan/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liudan/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liudan/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liudan/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/liudan/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to 192.168.1.1:22 as '80'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com  none
debug1: kex: client->server chacha20-poly1305@openssh.com  none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:fchZB16JdbpNZqqZcFxufdzPsRX3Om8Qm4Tgn1TqLfg
debug1: Host '192.168.1.1' is known and matches the ECDSA host key.
debug1: Found key in /Users/liudan/.ssh/known_hosts:27
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/liudan/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /Users/liudan/.ssh/id_dsa
debug1: Trying private key: /Users/liudan/.ssh/id_ecdsa
debug1: Trying private key: /Users/liudan/.ssh/id_ed25519
debug1: Next authentication method: password
80@192.168.1.1's password: 
debug1: Authentication succeeded (password).
Authenticated to 192.168.1.1 ([192.168.1.1]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.

卡住了20秒+

解决办法

原因

systemd-logind服务没有重启导致,可以systemctl status systemd-logind查看状态

解决方法就是重启该服务

systemctl restart systemd-logind

重新ssh就很快了

相关TAG标签
上一篇:执行环境及作用域
下一篇:Oracle环境通过SQL*PLUS本地登录时报错
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站