SSH似乎无法进入AWS EC2实例,ssh权限被拒绝错误

我已经使用Amazon 64位linux(amzn-ami-2011.09.1.x86_64-ebs(ami-20506254))推出了一个使用AWS的新EC2实例,并且遇到了麻烦。 我使用ssh-keygen -t rsa生成了公钥/私钥ssh密钥对,并将.pub(公共)密钥添加到EC2pipe理控制台中的密钥对中。

当我尝试运行:ssh -i〜/ .ssh / aws_ec2 -v ec2-46-137-17-221.eu-west-1.compute.amazonaws.com

我得到以下输出:

  OpenSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011 debug1: Reading configuration data /Users/casey/.ssh/config debug1: Reading configuration data /etc/ssh_config debug1: Connecting to ec2-79-125-85-42.eu-west-1.compute.amazonaws.com [79.125.85.42] port 22. debug1: Connection established. debug1: identity file /Users/casey/.ssh/aws_ec2 type 1 debug1: identity file /Users/casey/.ssh/id_rsa 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 'ec2-79-125-85-42.eu-west-1.compute.amazonaws.com' is known and matches the RSA host key. debug1: Found key in /Users/casey/.ssh/known_hosts:8 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: Offering public key: /Users/casey/.ssh/id_rsa debug1: Authentications that can continue: publickey debug1: Offering public key: /Users/casey/.ssh/aws_ec2 debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. Permission denied (publickey). 

不知道发生了什么事情,因为它确实提供了我的SSH私钥,但似乎只是被拒绝。 任何人都知道发生了什么事?

我想到了:

ssh -i ~/.ssh/aws_ec2 -v [email protected]

您需要使用ec2-user作为用户名。