首页 > 解决方案 > 使用热点 wifi 时,我无法 ssh 进入我的 ec2

问题描述

在我开始使用热点 wifi 而不是我的普通 wifi 之前,我从来没有遇到过这个问题。

尝试 ssh 到我的亚马逊实例时,我总是得到“连接被 xx.xxx.xxx.xx 关闭”:

jeff@jeff-Inspiron-5749:~$ ssh -v -i /path/to/key.pem ubuntu@9.99.999.99
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/jeff/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 9.99.999.99 [9.99.999.99] port 22.
debug1: Connection established.
debug1: identity file /path/to/key.pem type -1
debug1: identity file /path/to/key.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
Connection closed by 9.99.999.99

我还尝试更改我的 ec2 的入站安全规则以接受所有 ip 地址:0.0.0.0/0,这有时会起作用,但只是偶尔。

我目前通过在亚马逊上选择“使用我的 ip”将我的热点 IP 地址列入白名单。我怀疑这可能是我的热点 wifi 的连接/速度问题?但我可以在 youtube 上流式传输视频就好了...

我切换回正常的 wifi,这样我就可以登录到我的 ec2 并查看 /var/log/auth.log 文件,这就是我发现的:

AUG 20 08:05:01: session opened for user root by (uid=0)
AUG 20 08:05:01: session closed for user root 

在许多方面......总是在相同的时间。开放和立即关闭。

标签: amazon-ec2sshhotspot

解决方案


我想我可能找到了罪魁祸首:插入提供热点 wifi 的手机/平板电脑!!!我认为网络共享也可以解决这个问题。

我注意到在至少连接一次后,从那里我可以在没有插入热点 wifi 的情况下进行连接。


推荐阅读