2017-06-24 141 views
-2

我刚刚设置了我的AWS Deep Learning实例,并将其与我创建的新密钥对文件配对。Amazon ssh权限被拒绝(公钥),出现错误消息

然而,当我尝试用下面的命令SSH:

ssh -v -i /Users/username/aws-deep-learning-ami.pem [email protected]_IP.compute.amazonaws.com 

我得到了相当长的错误消息:权限被拒绝(公钥)。

打印与-v详细显示了这个:

OpenSSH_7.2p2, OpenSSL 1.0.2k 26 Jan 2017 
debug1: Reading configuration data /etc/ssh_config 
debug1: /etc/ssh_config line 57: Applying options for *.com 
debug1: /etc/ssh_config line 67: Applying options for *.* 
debug1: /etc/ssh_config line 77: Applying options for * 
debug1: Connecting to instance.amazonaws.com [ip] port 22. 
debug1: using TCP window size of 65536/65536 
debug1: Connection established. 
debug1: key_load_private_cert: No such file or directory 
debug1: key_load_cert: No such file or directory 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/username/aws-deep-learning-ami.pem type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/username/aws-deep-learning-ami.pem-cert type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/username/.ssh/id_rsa type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/username/.ssh/id_rsa-cert type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/username/.ssh/localhost/id_rsa type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/username/.ssh/localhost/id_rsa-cert type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/username/.ssh/clusterhost/id_rsa type -1 
debug1: key_load_public: No such file or directory 
debug1: identity file /Users/username/.ssh/clusterhost/id_rsa-cert type -1 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_7.2 
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1 
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000 
debug1: Authenticating to instance as 'ubuntu' 
debug1: Miscellaneous failure (see text) 
No credentials cache file found 

debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: algorithm: key 
debug1: kex: host key algorithm: key 
debug1: kex: server->client cipher: key MAC: <implicit> compression: none 
debug1: kex: client->server cipher: key MAC: <implicit> compression: none 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: key 
debug1: Host 'instance.compute.amazonaws.com' is known and matches the ECDSA host key. 
debug1: Found key in /Users/username/.ssh/known_hosts:7 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey 
debug1: Next authentication method: publickey 
debug1: Offering ECDSA public key: publickey 
debug1: Authentications that can continue: publickey 
debug1: Offering ECDSA-CERT public key: corp/normal 
debug1: Authentications that can continue: publickey 
debug1: Trying private key: /Users/username/aws-deep-learning-ami.pem 
debug1: Authentications that can continue: publickey 
debug1: Trying private key: /Users/username/.ssh/id_rsa 
debug1: Trying private key: /Users/username/.ssh/localhost/id_rsa 
debug1: Trying private key: /Users/username/.ssh/clusterhost/id_rsa 
debug1: No more authentication methods to try. 
Permission denied (publickey). 
+0

这只是意味着凭据不起作用 - 错误的凭据,错误的用户,不管。这不是一个真正的编程问题,或许更好[su]或[sf] – pvg

+0

感谢您的快速回复!我应该为每个密钥对使用不同的用户吗? – user3642173

+0

请尝试用户ec2-user。 – stdunbar

回答

1

一般情况下,默认的用户名是:

  • 亚马逊Linux使用ec2-user
  • Ubuntu AMI使用ubuntu
  • Amazon EMR使用hadoop
0

正如stdunbar提到的,我不得不使用EC2用户,而不是Ubuntu的