目录
事件背景:
在双机进行sftp文件传输时,输入密码后,约30s建立会话。
排查步骤:
第一步:确认卡在了哪里
- ssh -vvv 查看建立ssh会话卡在了哪里
ssh -p 22 -vvv root@10.0.0.2
卡顿在pledge: network之后
- 查看安全日志 :
/var/log/secure
第二步:依据第一步检查网络、认证加密算法
基础检查、优化SSH连接、清理尝试连接失败日志
- ping 服务器,发现无网络延迟
- 检查加密算法:正常
- 禁用DNS解析: UseDNS no
- 禁用GSSAPI :GSSAPIAuthentication no
- 清理尝试登录失败的日志: echo "" > /var/log/btmp
- 配置/etc/hosts
第三步:检查服务运行状态
- systemctl status sshd
- systemctl status dbus
- systemctl status systemd-logind
发现systemd-logind服务状态有以下提示
解决方法:
- 重启systemctl status systemd-logind
- 启用GSSAPI :GSSAPIAuthentication no
- 重启systemctl restart sshd
验证测试:
ssh -p 22 -vvv root@10.0.0.2 输入密码后,可快速建立连接