在移动SSL crt文件后不再能够通过SSH访问AWS
问题描述:
在AWS上安装SSL证书时,我重命名旧的crt文件(如傻瓜),现在我不再能够通过SSH访问AWS实例修复文件名称。在移动SSL crt文件后不再能够通过SSH访问AWS
有没有方法可以访问我的AWS实例的SSH以外的文件?或者,有没有办法在SSL证书关闭时继续使用SSH访问实例?
最初当我的文件名称的变更后的连接,我从服务器此提示响应时,SSH:
> ssh -vv -i tc.pem [email protected]
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 [email protected]
ssh: connect to host tc.com port 22: Connection timed out
如果我能进入的服务器或访问以任何方式重命名这些文件,这将是一个容易解决。感谢任何人可以提供的帮助。
答
这很容易做到。基本上,您将在另一个Instancce上挂载EC2实例的根卷(EBS卷),编辑.ssh/authorized_keys,然后将该卷重新挂接到您的实例。
这里是覆盖这一步一步的文章:
SSH Key Access Recovery on EC2 Instances
有一些互联网上的类似文章。
完美的工作。我正在关注[这个其他页面](https://aws.amazon.com/articles/how-to-recover-an-unreachable-linux-instance/),它和那个页面的信息几乎相同你提供。我确实有不同的挂载它,因为它是一个ext4,但这也包括[这里](https://*.com/questions/28792272/attaching-and-mounting-existing-ebs-volume-to-ec2 -instance-文件系统的问题)。谢谢你的帮助,约翰! – Rob