SSH连接到EC2时连接超时

24

我无法从Ubuntu 12.11 SSH连接到我的EC2实例。

我尝试了使用密钥作为凭据的所有SSH方法。

我使用了

ssh -v -i ~/.ec2/pes.pem ec2-user@ec2-54-209-148-122.compute-1.amazonaws.com

我得到的输出为

OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-54-209-148-122.compute-1.amazonaws.com [54.209.148.122] port 22.

debug1: connect to address 54.209.148.122 port 22: Connection timed out
ssh: connect to host ec2-54-209-148-122.compute-1.amazonaws.com port 22: Connection timed out

谢谢你,


检查实例上是否运行了ssh服务? - user2486495
ssh是程序员必备的工具,几乎只被程序员(一些网络管理员也使用)使用。 - James John McGuire 'Jahmic'
请确保与您的实例关联的安全组允许来自您的 IP 地址的 SSH 流量进入。默认安全组不会自动允许传入的 SSH 流量。更多信息请参阅 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html。 - Adittya Verma
2个回答

11

是的,我为22号端口配置了安全组,但仍然无法正常工作。 - bobbarav
1
忘记将调用服务器添加到白名单中了。就是这样! - James John McGuire 'Jahmic'
1
你是在哪里添加调用服务器到白名单的? - Marc
2
配置为端口22,并且立即启动 - user4301733
从AWS CLI中,可以这样为my_security_group_id授权端口22的访问权限:$ aws ec2 authorize-security-group-ingress --group-id <my_security_group_id> --protocol tcp --port 22 --cidr <my_ip>/32。其中,<my_ip>是指你的IP地址。 - Taylor D. Edmiston

1

检查防火墙是否阻止访问该端口或IP地址。可能是运行在客户机器上的防火墙、服务器机器上的防火墙或运行在客户网络中的网络防火墙。


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