当尝试通过ssh连接实例时,AWS EC2连接被关闭

79

最近我设置了一个新的EC2实例。第二天我无法通过SSH连接到我的实例。前一天我能够连接和断开连接,我确定我没有做任何更改。以下是SSH调试信息:

ssh -i webserver.pem -v ubuntu@my.elastic.ip
OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to my.elastic.ip [my.elastic.ip] port 22.
debug1: Connection established.
debug1: identity file webserver.pem type -1
debug1: identity file webserver.pem-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
debug1: SSH2_MSG_KEXINIT sent
Connection closed by my.elastic.ip

有没有解决这个问题的方法?还是我需要重新安装我的实例?

PS:我的.pem文件权限设置为600。


无法连接Amazon AWS EC2实例的SSH? - richvdh
11
在复制长连接 URL 时,很容易忘记输入 "ubuntu@"! - Fattie
11个回答

0

我遇到了同样的问题,但是我通过“重新启动”EC2来解决它。请注意,重新启动EC2不会更改其IP地址,但停止并再次启动会更改它。

这是一个简单的解决方法,但请确保您可以承受短暂的停机时间。在我的情况下,网站突然停止工作。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接