为什么不能SSH入我的Ubuntu服务器? (ssh_exchange_identification错误)

我试图SSH到我的Ubuntu服务器(我已经做了很多次),我得到的错误:

ssh_exchange_identification:由远程主机closures的连接

ssh -vvv显示如下:

jimsmith:etc jimsmith$ ssh -vvv galleryserver OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011 debug1: Reading configuration data /Users/jimsmith/.ssh/config debug1: Applying options for galleryserver debug1: Reading configuration data /etc/ssh_config debug2: ssh_connect: needpriv 0 debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22. debug1: Connection established. debug3: Not a RSA1 key file /Users/richardelliot/.ssh/galleryserverkey.pem. 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 debug2: key_type_from_name: unknown key type '-----END' debug3: key_read: missing keytype debug1: identity file /Users/richardelliot/.ssh/galleryserverkey.pem type -1 debug1: identity file /Users/richardelliot/.ssh/galleryserverkey.pem-cert type -1 ssh_exchange_identification: Connection closed by remote host 

任何人都可以帮忙吗?

–update —

我刚发现服务器已经升级了。 所以基本上它是一个新的机器,但它使用相同的密钥和IP地址

好像你没有使用正确的SSH私钥

 debug3: Not a RSA1 key file /Users/richardelliot/.ssh/galleryserverkey.pem. 

通常SSH密钥通常不是.pem文件 – 通常是为x509证书保留的。 检查〜/ .ssh中的ssh密钥; 通常你有“id_dsa”(私钥)和“id_dsa.pub”(公钥)之类的东西。 如果使用RSA,那么这些文件是id_rsa和id_rsa.pub。 确保您的SSHconfiguration〜/ .ssh / config指向该主机指向正确的SSH密钥。

如果这些文件不存在,您可以使用它们生成它们

 ssh-keygen -t dsa 

然后给你的私钥一个密码,并使用像钥匙串来pipe理你的密钥。 然后,您可以复制本地工作站公共密钥〜/ .ssh / id_dsa.pub,并将其合并到远程服务器上的〜/ .ssh / authorized_keys中 – 如果需要,可以创build该文件。 确保权限和服务器configuration是正确的。

好吧,我想清楚是什么问题。

一个名为拒绝主机的模块阻止了我的IP连接。

我设法从另一个IP地址连接,然后我的IP地址添加到/etc/hosts.allow文件。