ssh_exchange_identification:远程主机关闭连接

ssh_exchange_identification:远程主机关闭连接

我是服务器新手,所以如果这个问题很愚蠢,请原谅。我买了一台新 Mac,并从我的 Dropbox 下载了 Amazon AWS EC2 的 ssh 密钥对文件。

我尝试像往常一样连接到服务器:

ssh-add ~/.filename.pem 
Identity added: ....
ssh [email protected]
ssh_exchange_identification: Connection closed by remote host

我还尝试获取一些信息:

ssh -vv [email protected]
OpenSSH_7.6p1, LibreSSL 2.6.2
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to myserverpublicndsaddress.amazonaws.com port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/user/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
ssh_exchange_identification: Connection closed by remote host

有人能帮忙解决这个问题吗?

答案1

在我的情况下,分配弹性 IP 解决了问题。我不知道为什么 Ubuntu 会出现这种情况,因为 ssh 在 Amazon Linux 上不需要弹性 IP 就可以工作。

更新:原因很简单也很愚蠢。如您所知,俄罗斯的一些随机 IP 不可用。因此,弹性 IP 与此无关。启动 VPN 允许访问我的所有实例。

相关内容