连接到 Amazon EC2 实例时 SSH 挂起

标签 ssh amazon-ec2 ssh-keys pem

我可以使用以下命令连接到 ec2 实例,但今天我无法使用它进行连接。

ssh -i abcKey.pem ubuntu@ec2-x-x-x-x.ap-southeast-1.compute.amazonaws.com -v

以下是冗长的。我在 EC2 中打开了 SSH 端口(我可以连接到这个直到昨天)
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

最佳答案

一个可能的问题是安全组限制过于严格,您无法连接。要解决这个问题:

  • 转到 EC2 管理控制台
  • 单击安全组(在左侧边栏中)。
  • 选择您的 EC2 实例的安全组。
  • 在底部框中,单击“入站”选项卡。
  • 应该有一个 SSH 规则,确保它可以从任何地方访问,并且它位于正确的端口(SSH 为 22)。另外,请确保协议(protocol)是 TCP。
  • 关于连接到 Amazon EC2 实例时 SSH 挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29667729/

    相关文章:

    python - 对如何执行遥测的怀疑:使用开发板和笔记本电脑

    Cygwin 与某种 key 圈

    git - ssh:连接到主机 gitlab.com 端口 22:网络无法访问

    Java exec 或运行时无法与 ssh 一起使用

    ssh - 在远程 ssh session 中启动 ssh-agent

    linux - 在 Mathematica 中运行 ssh 命令

    python - 错误 : Cannot uninstall requests 2. 25.1,未找到记录文件。提示:该软件包是通过 rpm 安装的

    mysql - 当我访问 amazon-ec2 中的 mysqldb 时,远程访问被拒绝。 (1045, "Access denied for user ' 用户名' @'some-ip' )

    amazon-ec2 - CodeDeploy allowTraffic 失败,但我的代码仍部署在实例上

    ubuntu - 尝试通过 ssh 执行远程命令时出现未知密码类型错误