我使用 putty 通过 ssh 连接到几个主机。所有这些主机都允许公钥身份验证和密码身份验证。我之前能够登录这些主机,但突然间,在我尝试登录后不久,其中一些主机出现“网络错误:软件导致连接中止”的错误。
我尝试记录 ssh 数据包,当我尝试使用私钥登录时,这是日志文件的最后几行:
Event Log: Sent public key signature
Incoming packet #0x6, type 52 / 0x34 (SSH2_MSG_USERAUTH_SUCCESS)
Event Log: Access granted
Event Log: Opening session as main channel
Outgoing packet #0x7, type 90 / 0x5a (SSH2_MSG_CHANNEL_OPEN)
[some raw data]
当我尝试使用密码时:
Event Log: Sent password
Incoming packet #0x6, type 52 / 0x34 (SSH2_MSG_USERAUTH_SUCCESS)
Event Log: Access granted
Event Log: Opening session as main channel
Outgoing packet #0x8, type 90 / 0x5a (SSH2_MSG_CHANNEL_OPEN)
[some raw data]
我也尝试过plink -v
,这是输出的最后几行:
使用公钥时:
Sent public key signature
Access granted
Opening session as main channel
使用密码时:
Sent password
Access granted
Opening session as main channel
所有这些都导致网络错误:软件导致连接中止。
我可以使用 git bash (OpenSSH_7.6p1、OpenSSL 1.0.2n) 自带的 ssh 命令毫无问题地登录到这些主机。我还可以使用 putty 登录到其他一些主机。
我在同一台计算机和同一网络上进行了所有这些测试。
我如何才能找到这个问题的原因?
我使用 putty 0.70。这些是来自服务器的日志记录,我很确定它们与我的一些失败的登录尝试有关,也许值得注意的是,我是唯一有权访问此主机的人,因此这些数据与单个用户的活动有关:
04:42:46 static sshd[14329]: pam_unix(sshd:session): session opened for user root by (uid=0)
04:43:36 static sshd[14335]: Accepted password for root from [my-ip-address] port 1111 ssh2
04:43:36 static sshd[14335]: pam_unix(sshd:session): session opened for user root by (uid=0)
04:48:11 static sshd[14335]: Received disconnect from [my-ip-address] port 1111:11: disconnected by user
04:48:11 static sshd[14335]: Disconnected from [my-ip-address] port 1111
04:48:11 static sshd[14335]: pam_unix(sshd:session): session closed for user root
04:48:15 static sshd[14365]: Accepted password for root from [my-ip-address] port 1125 ssh2
04:48:15 static sshd[14365]: pam_unix(sshd:session): session opened for user root by (uid=0)
04:52:25 static sshd[14365]: Received disconnect from [my-ip-address] port 1125:11: disconnected by user
04:52:25 static sshd[14365]: Disconnected from [my-ip-address] port 1125
04:52:25 static sshd[14365]: pam_unix(sshd:session): session closed for user root
04:52:29 static sshd[14404]: Accepted password for root from [my-ip-address] port 1135 ssh2
04:52:29 static sshd[14404]: pam_unix(sshd:session): session opened for user root by (uid=0)
04:58:39 static sshd[14324]: pam_unix(sshd:session): session closed for user root
04:59:17 static sshd[14404]: pam_unix(sshd:session): session closed for user root
04:59:43 static sshd[14329]: pam_unix(sshd:session): session closed for user root
根据时间戳,我可以看到我的会话重叠了,但就我而言,我的所有登录尝试都导致错误。
我将 putty 更新到 0.71,然后我可以使用完全相同的设置连接到主机。此外,在另一个网络上使用 0.70 版本时,我可以成功登录到主机。
虽然我设法登录到主机,但我的问题仍然存在,如果有人能告诉我如何调查问题的根本原因,我将不胜感激。