![如何解决此错误:ssh_exchange_identification:远程主机关闭连接](https://linux22.com/image/796792/%E5%A6%82%E4%BD%95%E8%A7%A3%E5%86%B3%E6%AD%A4%E9%94%99%E8%AF%AF%EF%BC%9Assh_exchange_identification%EF%BC%9A%E8%BF%9C%E7%A8%8B%E4%B8%BB%E6%9C%BA%E5%85%B3%E9%97%AD%E8%BF%9E%E6%8E%A5.png)
data@server01:~$ ssh [email protected] -vvv
OpenSSH_5.5p1 Debian-6, OpenSSL 0.9.8o 01 Jun 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 10.7.4.1 [10.7.4.1] port 22.
debug1: Connection established.
debug3: Not a RSA1 key file /home/data/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/data/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/data/.ssh/id_rsa-cert type -1
debug1: identity file /home/data/.ssh/id_dsa type -1
debug1: identity file /home/data/.ssh/id_dsa-cert type -1
ssh_exchange_identification: Connection closed by remote host
答案1
我怀疑你的私钥有问题,可能是第一行。
不要将其粘贴到问题中。
您是如何生成私钥的?您可以尝试创建一个新的吗?(请记住,它们是成对出现的,因此只有当您也可以在另一端更改公钥时才可以这样做。)
答案2
密钥很可能是 SSL 或 PuTTY 格式。它与 Linux ssh 客户端/服务器不兼容。
答案3
是的,它的格式——看起来像是 Putty 生成的密钥。
要正确剪切/粘贴 puttygen 密钥,请参见此处: http://www.howtoforge.com/how-to-configure-ssh-keys-authentication-with-putty-and-linux-server-in-5-quick-steps
但是 - 您不是从 Windows 计算机进行 ssh 连接的,对吧?看起来您是从基于 Debian 的服务器 ssh 连接的私有 IP。您是否尝试在另一台主机上使用 puttygen 密钥?为什么要这样做而不是使用“ssh-keygen”?
我很好奇你在这里想做什么。你能提供更多细节吗?