无法登录 Amazon EC2 实例(初学者)

无法登录 Amazon EC2 实例(初学者)

我无法登录我的 Amazon ec2 实例。我设置了它,下载了密钥。起初它抱怨因为我的权限设置正确。然后我执行:chmod 400 myKey.pem。当我尝试登录时,我仍然得到: Permission denied (publickey)

接下来我删除了所有密钥并尝试刷新: rm -rf ~/.ssh

我对这个问题的其他回答感到困惑。似乎有 1000 件事可能会出错,我不知道从哪里开始。我使用 -v 选项运行它,它生成了以下输出(见下文)。我不知道该怎么做。

作为初学者,我下一步应该尝试什么?

-------------命令输出---------------

$ ssh -v -i myKey.pem [email protected] 
OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Connecting to ec2-107-20-xxx-yyy.compute-1.amazonaws.com
[107.20.xxx.yyy] port 22.
debug1: Connection established.
debug1: identity file myKey.pem type -1
debug1: identity file myKey.pem-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1
Debian-3ubuntu5
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
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: Server host key: RSA d2:5b:dc:9e:b2:b1:f0:b1:13:2c:25:7f:ed:e1:9e:49
debug1: Host 'ec2-107-20-xxx-yyy.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/me/.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: 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: myKey.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).

答案1

好的,我通过反复试验找到了这个问题的答案。

下面是AMAZON告诉我使用的字符串。

ssh -v -i myKey.pem [email protected]

接下来是我首先尝试的

ssh -v -i myKey.pem [email protected]

错误信息提示使用bitnami

ssh -v -i myKey.pem [email protected]

除了偶然发现这一点之外,我怎么知道用户名是 bitnami?

相关内容