【问题标题】:No longer able to access AWS via SSH after moving SSL crt files移动 SSL crt 文件后不再能够通过 SSH 访问 AWS
【发布时间】:2018-04-24 05:25:36
【问题描述】:

在 AWS 上安装 SSL 证书时,我重命名了旧的 crt 文件(像个傻瓜一样),现在我不再能够通过 SSH 访问 AWS 实例来修复文件名。

除了 SSH 之外,还有其他方法可以访问我的 AWS 实例的文件吗?或者,有没有办法在 SSL 证书关闭时继续使用 SSH 访问实例?

原来我在修改文件名后连接时,SSH时得到服务器的提示响应:

> ssh -vv -i tc.pem ubuntu@tc.com
OpenSSH_7.5p1, OpenSSL 1.0.2l  25 May 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "tc.com" port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to tc.com [1.1.1.1] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file tc.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file tc.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.5
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
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to tc.com:22 as 'ubuntu'
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 1.1.1.1 port 22

有一次我在服务器上重新启动了,现在,当我尝试 SSH 进入时,我得到了这个:

> ssh -i tc.pem ubuntu@tc.com
ssh: connect to host tc.com port 22: Connection timed out

如果我可以进入服务器或以任何方式访问文件来重命名它们,那将是一个简单的修复。感谢任何人可以提供的任何帮助。

【问题讨论】:

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


    【解决方案1】:

    这很容易做到。基本上,您会将 EC2 实例的根卷(EBS 卷)挂载到另一个实例上,编辑 .ssh/authorized_keys,然后将卷重新附加到您的实例。

    这是一篇逐步介绍此内容的文章:

    SSH Key Access Recovery on EC2 Instances

    网上有很多类似的文章。

    【讨论】:

    • 效果很好。我正在关注this other page,它的信息与您提供的信息几乎相同。因为它是 ext4,所以我确实必须以不同的方式安装它,但这也涵盖了 here。谢谢你的帮助,约翰!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-20
    • 2014-02-24
    • 2019-07-23
    • 1970-01-01
    • 2021-12-15
    • 1970-01-01
    相关资源
    最近更新 更多