AWS公钥被拒绝问题

时间:2011-08-17 15:15:45

标签: amazon-web-services public-key

我读过这篇文章:

AWS ssh access 'Permission denied (publickey)' issue

这些信息是相关的,但不能帮助我解决我的问题。我曾经能够使用ec2-user使用以下命令登录我在AWS上的linux实例:

我的MacBook终端上的ssh -i key.pem ec2-user @ [address] .compute-1.amazonaws.com

过去几周,我现在收到此错误:

“权限被拒绝(公钥)。”

我试过

我的MacBook终端上的ssh -v -i key.pem ec2-user @ [address] .compute-1.amazonaws.com

我得到了这个输出:

OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to [address].compute-1.amazonaws.com [address] port 22.
debug1: Connection established.
debug1: identity file key.pem 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.2
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 '[address].compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in [path]/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
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: key.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).

有关正在发生的事情的任何建议?如何解决这个问题?

我之前创建的此实例上有另一个用户帐户。我可以使用它登录,并将sudo登录到root。我再也无法使用ec2-user登录了。

谢谢!

1 个答案:

答案 0 :(得分:1)

您可能必须以root用户身份登录。如果使用bitnami图像,请以“bitnami”

登录

e.g。 ssh -v -i key.pem bitnami@[address].compute-1.amazonaws.com