我在远程机器上运行Ubuntu 10.10。 我每天ssh没有问题,但今天突然间,我得到以下错误:
ssh_exchange_identification: Connection closed by remote host
如果我连接-vv ,我得到以下内容:
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011 debug1: Reading configuration data /Users/bla/.ssh/config debug1: Applying options for ubuntu-server debug1: Reading configuration data /etc/ssh_config debug1: Applying options for * debug2: ssh_connect: needpriv 0 debug1: Connecting to ubuntu-server.com [123.123.123.123] port 22. debug1: Connection established. debug2: key_type_from_name: unknown key type '-----BEGIN' debug2: key_type_from_name: unknown key type '-----END' debug1: identity file /Users/bla/.ssh/id_rsa type -1 debug1: identity file /Users/bla/.ssh/id_rsa-cert type -1 ssh_exchange_identification: Connection closed by remote host
如果我删除密钥,我得到完全相同的输出(sans“debug2:key_type _…)。我设法login物理和检查我的hosts.allow和hosts.deny但他们没有条目。并重新安装OpenSSH,检查authorized_keys和~/.ssh权限,并尝试从其他计算机连接,只是为了得到相同的错误,我在我的智慧结束,任何帮助将不胜感激。
几乎可以肯定的是/etc/hosts.deny文件有一个你的机器的条目,添加
sshd: xxx.yyy.zzz.aaa
为你的连接IP地址/etc/hosts.allow
同样的错误
ssh_exchange_identification:由远程主机closures的连接
发生私钥(文件)是所有人都可读,即有错误的权限。
例如,如果有任何的私钥
ssh_host_key ssh_host_dsa_key ssh_host_rsa_key 在/etc/ssh/是chmod 644 (应该是chmod 600 )。
以下权限导致“ssh_exchange_identification:连接被远程主机closures”错误:
root@host:/etc/config/ssh# ls -la drwxrwxrwx 2 root root 0 Aug 24 2005 . drw-rw-rw- 3 root root 0 Apr 3 2007 .. -rw-r--r-- 1 root root 88039 Aug 24 2005 moduli -rw-r--r-- 1 root root 1559 Aug 24 2005 ssh_config -rw-r--r-- 1 root root 668 Aug 24 2005 ssh_host_dsa_key -rw-r--r-- 1 root root 599 Aug 24 2005 ssh_host_dsa_key.pub -rw-r--r-- 1 root root 524 Aug 24 2005 ssh_host_key -rw-r--r-- 1 root root 328 Aug 24 2005 ssh_host_key.pub -rw-r--r-- 1 root root 883 Aug 24 2005 ssh_host_rsa_key -rw-r--r-- 1 root root 219 Aug 24 2005 ssh_host_rsa_key.pub -rw-r--r-- 1 root root 2018 Aug 25 2005 sshd_config
更正的权限,连接现在应该被接受:
root@host:/etc/config/ssh# ls -la drwxrwxrwx 2 root root 0 Aug 24 2005 . drw-rw-rw- 3 root root 0 Apr 3 2007 .. -rw-r--r-- 1 root root 88039 Aug 24 2005 moduli -rw-r--r-- 1 root root 1559 Aug 24 2005 ssh_config -rw------- 1 root root 668 Aug 24 2005 ssh_host_dsa_key -rw-r--r-- 1 root root 599 Aug 24 2005 ssh_host_dsa_key.pub -rw------- 1 root root 524 Aug 24 2005 ssh_host_key -rw-r--r-- 1 root root 328 Aug 24 2005 ssh_host_key.pub -rw------- 1 root root 883 Aug 24 2005 ssh_host_rsa_key -rw-r--r-- 1 root root 219 Aug 24 2005 ssh_host_rsa_key.pub -rw-r--r-- 1 root root 2018 Aug 25 2005 sshd_config
-rw------- 1 user group 405 2011-10-29 10:20 authorized_keys2
authorized_keys2已从版本3.0 弃用 。
debug3: Not a RSA1 key file /Users/bla/.ssh/id_rsa. debug2: key_type_from_name: unknown key type '-----BEGIN' debug3: key_read: missing keytype debug3: key_read: missing whitespace
它看起来像你的私钥已损坏。 重新生成密钥对,使用ssh-copy-id将您的公钥安装到authorized_keys文件中,然后重试。
在做什么之间可以有一个新的防火墙吗? 我曾经遇到过一个问题,就是在引入了新的防火墙的情况下,引入了同样的问题。 新的防火墙是在服务器端引入的。
这里可能有几个问题。
sshd_config文件中的各种*Authentication指令来设置。
ssh-keygen -e -i和-m标志。