我在AWS EC2上丢失了我的原始实例的私钥,我花了2.5天寻找解决方案,徒劳无功。
我创建了另一个密钥对,使用新卷启动了新实例并实现了SSH连接。然后我停止了新实例,将原始卷作为新实例的辅助卷附加,并启动了新实例。奇怪的是,我无法连接。 (是的,我使用新的公共DNS - 停止/启动后)。
然后我停止新实例,分离原始卷,再次启动新实例,然后连接。在实例运行的情况下,我附加了原始卷,将其挂载并将原始卷的 .ssh / authorized_keys 更改为新密钥对 :
[ubuntu ~]$ cp .ssh/authorized_keys /mnt/originalvol/home/ubuntu/.ssh/authorized_keys
我卸载了卷,停止了实例,分离了原始卷并将其附加到原始实例,将其打开并且... 权限被拒绝
然后我尝试了实例和卷之间的变化,但每次连接原始卷(作为主卷或辅助卷)时,我都无法连接。
我尝试创建原始实例和卷的AMI,并根据AMI创建新的实例/卷,但它不起作用。
我试图避免将我的所有网站文件复制到新的实例/卷中并再次配置它。
任何人都可以帮忙找到解决此问题的方法吗?
由于
Saulo
编辑#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$