EC2 + ssh:权限被拒绝(publickey)

时间:2014-07-11 21:27:33

标签: amazon-ec2

我第一次在AWS上打开了一个新的EC2实例。但是我无法通过SSH连接它,因为它为我提供了Permission denied (publickey)

也许是因为我还没有对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).

这是一个全新的服务器,带有新生成的私钥。如果您需要更多信息,请与我们联系。

== UPDATE ==

Nets-Mac-Pro:Downloads emai$ ssh -i new.pem emai@54.88.57.225
Permission denied (publickey).

1 个答案:

答案 0 :(得分:2)

尝试使用ssh -i new.pem ec2-user @ your-ip,假设它是一个Amazon Linux发行版。