LuY*_*uYi 5 linux ssh ubuntu sshd
当我想使用VScode远程SSH连接我的服务器时,提示以下错误:
... ... kex_exchange_identification:横幅行包含无效字符 ... ...
一开始我以为是我的VSCode的错误,但是我在PowerShell中尝试了最简单的SSH命令,它仍然发生。
这是一些日志:
(base) PS C:\Users\37097> ssh wsco@114.213.208.99 -p 1260 -v OpenSSH_8.2p1, OpenSSL 1.1.1f 31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to 114.213.208.99 [114.213.208.99] port 1260.
debug1: Connection established.
debug1: identity file /c/Users/37097/.ssh/id_rsa type -1
debug1: identity file /c/Users/37097/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/37097/.ssh/id_dsa type -1
debug1: identity file /c/Users/37097/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/37097/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/37097/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/37097/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/37097/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/37097/.ssh/id_ed25519 type -1
debug1: identity file /c/Users/37097/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/37097/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/37097/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/37097/.ssh/id_xmss type -1
debug1: identity file /c/Users/37097/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2
kex_exchange_identification: banner line contains invalid characters
Run Code Online (Sandbox Code Playgroud)
我什至在另一台 ubuntu 机器上尝试过,但遇到了同样的问题。
我尝试用谷歌搜索了几天,但都无法解决我的问题。
小智 11
我看到这个没有回复,希望你能同时修复它。
对于其他正在寻找的人
kex_exchange_identification:横幅行包含无效字符
请注意,当错误连接到 Web 服务器 (https) 而不是 sshd 时,ssh 会报告此错误。
检查 sshd 是否正在侦听您要连接的主机/端口,例如使用netstat -anp
当 SSH 客户端连接到 SSH 服务器时,SSH 服务器进程首先以明文形式向客户端发送版本字符串。您可以使用“nc”来查看它:
$ nc localhost 22
SSH-2.0-OpenSSH_8.6
Run Code Online (Sandbox Code Playgroud)
“kex_exchange_identification”表示客户端刚刚连接到服务器,正在等待接收此版本字符串。错误“横幅行包含无效字符”意味着客户端从服务器收到的内容不是有效的 SSH 版本字符串。
实际上,问题可能是 SSH 客户端连接到的不是 SSH 服务器。正如另一个答案中所述,使用 SSH 客户端连接到 HTTPS 服务器将产生以下错误:
$ ssh -p https google.com
kex_exchange_identification: banner line contains invalid characters
Run Code Online (Sandbox Code Playgroud)
根本原因可能是以下三件事之一: