【发布时间】:2021-04-19 14:53:42
【问题描述】:
我重新格式化了我的 macbook,完全忘记了复制我的 ~/.ssh 目录。
我尝试通过 ssh 连接到我的 EC2 实例
$ ssh ec2-user@xx.xxx.xxx.xx -i xxx.pem -v
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to xx.xxx.xxx.xx [xx.xxx.xxx.xx] port 22.
debug1: connect to address xx.xxx.xxx.xx port 22: Operation timed out
ssh: connect to host xx.xxx.xxx.xx port 22: Operation timed out
但我认为它不起作用,因为我的 PEM 文件链接到旧笔记本电脑上的 id_rsa 文件?
我的谷歌驱动器中有 PEM 文件。
我试过了
sudo chmod 400 xxx.pem- 更新我的安全组以允许 SSH 访问 到我的新笔记本电脑
任何想法如何重新获得对我的 EC2 实例的访问权限?
我会生成一个新的密钥对as explain here,但它要求我有权访问该实例
【问题讨论】:
-
这不是关键问题。关键问题会导致身份验证失败,但您会遇到网络超时
-
超时表示您的计算机未成功连接到 Amazon EC2 实例。这可能是由于安全组限制了传入 IP 地址的范围(入站安全组中有什么?),或者可能是 EC2 实例更改了 IP 地址并且您正在连接到旧 IP 地址(检查控制台!)。
标签: amazon-web-services amazon-ec2 ssh