【问题标题】:Error while connecting to EC2 instance连接到 EC2 实例时出错
【发布时间】:2012-04-03 22:52:39
【问题描述】:

这是日志:

macs-MacBook-Air:~ mac$ ssh -v -i sohoKey.pem ec2-user@ec2-107-22-101-75.compute-1.amazonaws.com 
OpenSSH_5.6p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Applying options for *
debug1: Connecting to ec2-107-22-101-75.compute-1.amazonaws.com [107.22.101.75] port 22.
debug1: Connection established.
debug1: identity file sohoKey.pem type -1
debug1: identity file sohoKey.pem-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-107-22-101-75.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /Users/mac/.ssh/known_hosts:3
debug1: ssh_rsa_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: Offering RSA public key: sohoKey.pem
debug1: Authentications that can continue: publickey
debug1: Trying private key: sohoKey.pem

debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

在 AWS 控制台中,我看到我的密钥对已被删除。我创建了一个新的同名的。然后我尝试连接 ssh -v -i sohoKey.pem ec2-user@ec2-107-22-101-75.compute-1.amazonaws.com

【问题讨论】:

标签: ssh amazon-ec2


【解决方案1】:

创建具有相同名称的密钥对无济于事 - 重要的是其中的数据。

也无法在正在运行的实例上更改密钥对,我不相信您可以做任何事情。如果您要从实例中恢复数据并且该卷是 EBS 卷,则您可以将该卷标记为在终止时不被删除。终止实例后,卷应保持不变,您将能够将其附加到不同的实例。

【讨论】:

  • 非常糟糕。我如何从那个死实例接收我的数据?
【解决方案2】:

您可以尝试启动一个新实例,然后断开与您丢失密钥对的存储的连接,然后将其添加到新实例中。

另一种选择,但我没有尝试过,是从当前实例中创建一个新图像。完成后,创建新映像的新实例并创建新的密钥对。

无论哪种方式,您都失去了连接能力,并且无法向实例添加新的密钥对(据我所知)。

【讨论】:

【解决方案3】:

我从实例中分离了我的 EBS 卷。之后,我创建了一个新实例,然后将 8GB EBS 附加到该实例上。

之后,我将该实例挂载到 /mybackup。

所以我可以从 /mybackup/... 获取我的数据

感谢您的建议。

但我还是不知道,为什么我的密钥对不见了?

【讨论】:

    猜你喜欢
    • 2021-07-23
    • 2015-10-19
    • 1970-01-01
    • 1970-01-01
    • 2020-04-29
    • 2014-02-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-07
    相关资源
    最近更新 更多