Amazon ec2 EC2&x2B;ssh:权限被拒绝(公钥)

Amazon ec2 EC2&x2B;ssh:权限被拒绝(公钥),amazon-ec2,Amazon Ec2,我第一次在AWS上打开了一个新的EC2实例。但是,我不能SSH到它,因为它给我拒绝权限(公钥) 可能是因为我没有对new.pem文件做任何操作??我应该如何处理我的new.pem文件 Nets-Mac-Pro:Downloads emai$ ssh -v -i new.pem 12.12.12.123 OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug

我第一次在AWS上打开了一个新的EC2实例。但是,我不能SSH到它,因为它给我
拒绝权限(公钥)

可能是因为我没有对
new.pem
文件做任何操作??我应该如何处理我的
new.pem
文件

Nets-Mac-Pro:Downloads emai$ ssh -v -i new.pem 12.12.12.123
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to 12.12.12.123 [12.12.12.123] port 22.
debug1: Connection established.
debug1: identity file new.pem type -1
debug1: identity file new.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com 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 18:0a:02:e7:75:25:7e:78:27:a2:c8:ec:0a:e0:c0:a8
debug1: Host '12.12.12.123' is known and matches the RSA host key.
debug1: Found key in /Users/emai/.ssh/known_hosts:77
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: new.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).

尝试ssh-i new.pem ec2-user@your-ip假定它是Amazon Linux发行版

您需要使用
user@IP
-l user
语法按用户您是指我的IAM用户吗?我更新了bottomNo上的问题,bottomNo是登录新EC2实例的用户名。亚马逊的默认值是
ec2用户
,正如Harry所建议的,很好用!!那么现在我是否直接从控制台创建用户?我以为我刚刚创建的IAM用户组+用户会出现(尽管我在创建实例后才创建)?值得一看:嘿,Harry,我更新了我的问题,尝试了你的方法。。没有work@Edmund尝试使用
ec2用户
,而不是您登录计算机时使用的用户名,而是创建Amazon AMImage的人使用的用户名,该用户名通常是
ec2用户
您的根密钥(new.pem)引用ec2用户。所以您需要使用ssh-i new.pem ec2 user@
Nets-Mac-Pro:Downloads emai$ ssh -i new.pem emai@54.88.57.225
Permission denied (publickey).