【问题标题】:How to access EC2 instance via SSH on mac with Operation Timed Out?如何在 Mac 上通过 SSH 访问 EC2 实例,操作超时?
【发布时间】:2021-02-05 11:06:24
【问题描述】:

我正在尝试在我的终端上使用以下命令行连接到 EC2 机器:

ssh -i id_rsa_aws <ec2_ip_address> -l ec2-user -vvv

结果如下:

debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug2: resolve_canonicalize: hostname <ec2_ip_address> is address
debug2: ssh_connect_direct
debug1: Connecting to <ec2_ip_address> [<ec2_ip_address>] port 22.
debug1: Connection established.
debug1: identity file id_rsa_aws type 0
debug1: identity file id_rsa_aws-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.8
ssh_exchange_identification: read: Operation timed out

我的 ssh_config 文件:


Host *
        SendEnv LANG LC_*

我知道问题一定来自我的电脑。我曾尝试使用 .pem 文件,但遇到了同样的错误。

任何帮助将不胜感激。

谢谢

【问题讨论】:

  • 您能否通过 SSH 连接到同一子网中的任何其他 EC2 实例?

标签: amazon-web-services amazon-ec2 ssh


【解决方案1】:

检查事项:

  • 实例正在运行 Linux
  • 实例在公共子网中启动,该子网定义为具有指向 Internet 网关的路由表条目
  • 实例有一个公共 IP 地址,您正在使用该地址进行连接
  • 网络访问控制列表 (NACL) 设置为其默认的“全部允许”值
  • 与实例关联的安全组允许从您的 IP 地址或 Internet (0.0.0.0/0) 在端口 22 (SSH) 上进行入站访问
  • 您的网络允许出站 SSH 连接(尝试备用网络,例如家庭网络、工作网络和连接到您的手机)

另请参阅:Troubleshooting connecting to your instance - Amazon Elastic Compute Cloud

【讨论】:

    猜你喜欢
    • 2020-07-05
    • 2011-08-23
    • 2021-06-02
    • 2018-04-17
    • 2012-01-10
    • 1970-01-01
    • 1970-01-01
    • 2020-03-13
    • 1970-01-01
    相关资源
    最近更新 更多