错误:ssh_exchange_identification:远程主机关闭连接?

错误:ssh_exchange_identification:远程主机关闭连接?

在 Linux 中运行 ssh 时出现以下错误

 ssh root@localhost -p 4440 -vvv
 OpenSSH_5.0p1, OpenSSL 0.9.8g 19 Oct 2007
 debug1: Reading configuration data /etc/ssh/ssh_config
 debug1: Applying options for *
 debug3: cipher ok: aes128-ctr [aes128-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc]
 debug3: cipher ok: aes256-ctr [aes128-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc]
 debug3: cipher ok: arcfour256 [aes128-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc]
 debug3: cipher ok: arcfour128 [aes128-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc]
 debug3: cipher ok: aes128-cbc [aes128-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc]
 debug3: cipher ok: 3des-cbc [aes128-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc]
 debug3: ciphers ok: [aes128-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc]
 debug2: mac_setup: found hmac-sha1
 debug3: mac ok: hmac-sha1 [hmac-sha1,hmac-ripemd160]
 debug2: mac_setup: found hmac-ripemd160
 debug3: mac ok: hmac-ripemd160 [hmac-sha1,hmac-ripemd160]
 debug3: macs ok: [hmac-sha1,hmac-ripemd160]
 debug2: ssh_connect: needpriv 0
 debug1: Connecting to localhost [127.0.0.1] port 4440.
 debug1: Connection established. 
 debug1: permanently_set_uid: 0/0
 debug1: identity file /root/.ssh/identity type -1 
 debug3: Not a RSA1 key file /root/.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 /root/.ssh/id_rsa type 1
  debug1: identity file /root/.ssh/id_dsa type -1
ssh_exchange_identification: Connection closed by remote host

有人能告诉我为什么会出现这个问题以及如何解决这个问题吗?

答案1

看起来 root 的 id_rsa 密钥格式不好,可能已经过时了。尝试使用 ssh-keygen 创建一个新密钥。另外检查/更新您的身份文件,如果不需要,请将其删除。

相关内容