0

我在 AWS EC2 上丢失了原始实例的私钥,我花了 2.5 天时间寻找解决方案,但徒劳无功。

按照 AWS 帮助的说明...

我创建了另一个密钥对,使用新卷启动了一个新实例实现了 SSH 连接。然后我停止了新实例,将原始卷作为新实例的辅助卷附加并启动了新实例。奇怪的是,我无法连接。(是的,我使用了新的公共 DNS - 在停止/启动之后)。

然后我停止了新实例,分离了原始卷,再次启动了新实例 ,它连接了。随着实例的运行,我附加了原始卷,挂载它并将原始卷的.ssh/authorized_keys更改为新的密钥对

[ubuntu ~]$ cp .ssh/authorized_keys /mnt/originalvol/home/ubuntu/.ssh/authorized_keys

我卸载了卷,停止了实例,分离了原始卷并将其附加到原始实例,打开它并... Permission denied

然后我尝试了实例和卷之间的变化,但是每次附加原始卷(作为主卷或作为辅助卷)时,我都无法连接。

以下是本网站中此类其他问题的说明...

我尝试为我的原始实例和卷创建一个 AMI,并基于 AMI 创建一个新的实例/卷,但它不起作用。

我试图避免将我所有的网站文件复制到一个新的实例/卷中并再次配置它。

任何人都可以帮助找到解决此问题的方法吗?

谢谢

绍洛


编辑#1:命令 ssh 的日志...

saulo@saulo-VirtualBox:~/ssh_keys$ ssh -v -i GeorgeTeste.pem ubuntu@ec2-52-33-160-205.us-west-2.compute.amazonaws.com
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-52-33-160-205.us-west-2.compute.amazonaws.com [52.33.160.205] port 22.
debug1: Connection established.
debug1: identity file GeorgeTeste.pem type -1
debug1: identity file GeorgeTeste.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.3
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 24:52:41:2d:c5:f7:ea:1c:56:cd:e9:3d:37:56:de:14
debug1: Host 'ec2-52-33-160-205.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /home/saulo/.ssh/known_hosts:11
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: GeorgeTeste.pem
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
saulo@saulo-VirtualBox:~/ssh_keys$ 
4

0 回答 0