AWS公钥被拒绝问题

发布于 2024-11-30 05:09:54 字数 2099 浏览 4 评论 0原文

我读了这篇文章:

AWS ssh 访问“权限被拒绝(公钥)”问题

那里的信息是相关的,但不能帮助我解决我的问题。我过去能够使用 ec2-user 使用以下命令登录 AWS 上的 Linux 实例:

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

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

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

从 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 进入根目录。我只是无法再使用 ec2-user 登录。

谢谢!

I read this post:

AWS ssh access 'Permission denied (publickey)' issue

The information there is relevant, but does not help me solve my issue. I used to be able to login to my linux instance on AWS using ec2-user using the following command:

ssh -i key.pem ec2-user@[address].compute-1.amazonaws.com from my MacBook terminal

over the past few weeks, I'm getting this error now:

"Permission denied (publickey)."

I tried

ssh -v -i key.pem ec2-user@[address].compute-1.amazonaws.com from my MacBook terminal

and I get this output:

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).

Any advice on what's going on? How to get around this?

I have another user account on this instance that I previously created. I am able to login with that, and sudo into the root. I just cannot login with ec2-user anymore.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

如梦亦如幻 2024-12-07 05:09:54

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

例如 ssh -v -i key.pem bitnami@[address].compute-1.amazonaws.com

You may have to log in as root. If using a bitnami image, login as 'bitnami'

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文