SSH连接到Amazon EC2实例时挂起

问题描述 投票:6回答:3

我可以连接使用下列命令EC2实例,但今天我无法使用它连接。

ssh -i abcKey.pem [email protected] -v

以下是详细。我已经开了SSH在EC2端口(我可以连接到这个直到昨天)

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-x-x-x-x.ap-southeast-1.compute.amazonaws.com [x-x-x-x] port 22.
debug1: Connection established.
debug1: identity file abcKey.pem type -1
debug1: identity file abcKey.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
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
ssh amazon-ec2 ssh-keys pem
3个回答
15
投票

一个可能的问题是,安全组的限制过于严格,你要能够连接的。为了解决这个问题:

  1. 转至EC2管理控制台
  2. 点击安全组(在左侧边栏)。
  3. 选择您的EC2实例的安全组。
  4. 在底部框中,单击入站选项卡上。
  5. 应该有一个SSH规则,确保它可以从任何地方访问,它是正确的端口(22 SSH)上。此外,请确保该协议是TCP。

7
投票

我也有同样的问题。我遵循的亚马逊视频建议办理悬挂SSH连接尝试。没有骰子。在什么情况下,我的工作是使用下面的命令:

ssh -i yourKeyHere.pem ec2-user@yourPublicIPHere -v

该publicIP在EC2管理控制台publicIp下。


2
投票

我发现我被卡住,因为我的路由表没有Internet网关设置。

我添加了一个Internet网关,连接到我的VPC,然后加入0.0.0.0/0到我的路由表针对互联网网关。这解决了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.