ssh 连接失败时 dispatch_protocol_error: type 51 seq 5 是什么意思以及如何解决?

ssh 连接失败时 dispatch_protocol_error: type 51 seq 5 是什么意思以及如何解决?

我正在尝试使用以下命令通过 SSH 连接到 Linux 服务器:

ssh [email protected] -p 22

但是,我无法连接到它。只有一条消息dispatch_protocol_error: type 51 seq 5。 ssh 命令挂起大约一两分钟,直到它关闭并显示以下消息:

Connection to ip.of.server.com closed by remote host.
Connection to ip.of.server.com closed.

在 Google 中搜索 dispatch_protocol_error 消息没有找到与此特定调度协议错误相关的任何内容,大多数人询问不同的调度协议错误(type 和 seq 有不同的值),并且没有一个解释这个错误消息的含义。

唯一或多或少有趣的事情是这个 OpenSSH 常见问题解答,其中一个问题是关于“调度协议错误:类型 20”,这是因为“旧版本的 OpenSSH 不支持会话重新密钥”。它建议我添加RekeyIntervalSeconds 0到“SSH 2.3 的 ssh2_config 或 sshd2_config”。为了看看会发生什么,我尝试将其添加到我的(客户端)ssh_config(我没有 ssh2_config 文件),但这没有帮助(事实上,这是一个“错误的配置选项”)。

我尝试不使用端口 ( ) 进行连接,结果是一样的。我还尝试ssh [email protected]从已知主机列表中删除该主机通过使用ssh-keygen -R hostname,假设这是当前 RSA 密钥指纹的问题。然而,这不允许我连接,并且显示了相同的错误消息。

我使用的是 Ubuntu 16.04,服务器是 CentOS 6.8。我的(客户端)SSH 版本是 7.2 版(来自这个答案: ssh -v localhost):

OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g

我的猜测是,这是一个服务器问题,我的老板也同意这一点,所以我无法仅通过在计算机上工作来解决这个问题。

我的问题是,此错误信息的含义以及如何解决

附言:我不是 SSH 专家,所以我可能做了非常愚蠢的行为,并错过了解决这个问题的关键信息。

编辑:我使用 -v(详细)选项运行 ssh。根据它,我能够连接并进行身份验证(debug1: Authentication succeeded (none).)。在此消息之后,有以下消息,包括我的错误。完整日志如下:

OpenSSH_7.2p2 Ubuntu-4ubuntu2.2, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ip.of.server.com [ip.of.server.com] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/myuser/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/myuser/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/myuser/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/myuser/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/myuser/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/myuser/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/myuser/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/myuser/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: Authenticating to ip.of.server.com:22 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: [email protected] compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: [email protected] compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:server_host_key_ssh_rsa_is_here
debug1: Host 'ip.of.server.com' is known and matches the RSA host key.
debug1: Found key in /home/myuser/.ssh/known_hosts:6
debug1: rekey after 3249842342 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 3249842342 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentication succeeded (none).
Authenticated to ip.of.server.com ([ip.of.server.com]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: network
dispatch_protocol_error: type 51 seq 5
debug1: Received SSH2_MSG_UNIMPLEMENTED for 6
debug1: Received SSH2_MSG_UNIMPLEMENTED for 7
debug1: Received SSH2_MSG_UNIMPLEMENTED for 9
debug1: Received SSH2_MSG_UNIMPLEMENTED for 10
debug1: Received SSH2_MSG_UNIMPLEMENTED for 11
debug1: Received SSH2_MSG_UNIMPLEMENTED for 12

... (there are lots of this SSH2_MSG_UNIMPLEMENTED message)

debug1: Received SSH2_MSG_UNIMPLEMENTED for 60
debug1: Received SSH2_MSG_UNIMPLEMENTED for 61
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 1 clearing O_NONBLOCK
debug1: channel 0: free: client-session, nchannels 1
Connection to ip.of.server.com closed by remote host.
Connection to ip.of.server.com closed.
Transferred: sent ..., received ... bytes, in ... seconds
Bytes per second: sent ..., received ...
debug1: Exit status -1

关于服务器端:查看 CentOS 的 sshd 日志/var/log/secure这个答案如图所示),唯一相关的结果是重复类似的错误:

Jan  5 14:38:44 myserverside sshd[1234]: dispatch_protocol_error: type 90 seq 6
Jan  5 14:38:44 myserverside sshd[1234]: dispatch_protocol_error: type 80 seq 7
Jan  5 14:38:46 myserverside sshd[1234]: dispatch_protocol_error: type 80 seq 9
Jan  5 14:38:48 myserverside sshd[1234]: dispatch_protocol_error: type 80 seq 10
Jan  5 14:38:50 myserverside sshd[1234]: dispatch_protocol_error: type 80 seq 11
Jan  5 14:38:52 myserverside sshd[1234]: dispatch_protocol_error: type 80 seq 12

...

Jan  5 14:40:31 myserverside sshd[1234]: dispatch_protocol_error: type 80 seq 60
Jan  5 14:40:33 myserverside sshd[1234]: dispatch_protocol_error: type 80 seq 61

此条目前后的其他条目(具有其他 ID)不是来自此特定尝试(它们来自我成功的 PuTTY 连接,正如我通过时间数据看到的那样)。应该注意的是,这些错误消息中的数字与我在客户端收到的数字相同。

尝试使用 -M 标志()导致同样的错误。ssh -M [email protected]

奇怪的是,使用装有旧版 Ubuntu(Ubuntu 12.04)的客户端,我能够连接。所以可能是版本不兼容(服务器太旧和/或客户端太新)——可能是 SSH 最近更新,因为大约一个月前我能够使用 Ubuntu 16.04 计算机进行连接,或者可能是配置问题。

附言:我能够通过 PuTTY(Ubuntu 版本)成功连接。因此问题仅在尝试通过 SSH 连接时发生。

相关内容