2015-12-31 159 views
1

我试图使用命令来建立一个AWS服务器的SSH连接:AWS SSH连接问题:权限被拒绝(公钥)

的ssh -v -i ABC-密钥对,nvirginia.pem管理员@ EC2-XX -xx-xx-xxx.compute-1.amazonaws.com (试过根/ Ubuntu的/ EC2用户,而不是管理太)

日志跟踪:

debug1: sending SSH2_MSG_KEX_ECDH_INIT 
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY 
debug1: Server host key: ECDSA 1x:xx:aa:aa:aa:aa:a0:aa:aa:aa:aa:aa:aa:aa:xx:xx 
debug1: Host 'ec2-xx-xx-xx-xxx.compute-1.amazonaws.com' is known and matches the ECDSA host key. 
debug1: Found key in /home/abc/.ssh/known_hosts:12 
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: Offering RSA public key: [email protected] 
debug1: Authentications that can continue: publickey 
debug1: Trying private key: abc-key-pair-nvirginia.pem 
debug1: Authentications that can continue: publickey 
debug1: No more authentication methods to try. 
Permission denied (publickey). 

我见过几个环节在互联网上,但无法弄清楚如何解决这个问题。有人可以请建议如何调试? 谢谢,

+0

什么Linux发行版是nstance?这是您实例启动后第一次连接吗? – helloV

+0

我使用的是Ubuntu 14.我昨天创建了这个帐户,并且自那以后尝试了多次,但是发生了相同的错误。 – Naveen

+0

使用ubuntu @ host。你确定你正在使用正确的私钥吗? – helloV

回答

0

如果您使用Ubuntu实例使用用户名,ubuntu。示例如下:

ssh -v -i abc-key-pair-nvirginia.pem [email protected] 

如果失败了,那么您需要检查您的实例是否已使用您使用的密钥对开始。

此外,请确保您的密钥文件具有正确的权限。你可以设置那些使用:

chmod 600 abc-key-pair-nvirginia.pem 
+0

不适用于Ubuntu。同样的错误。 – Naveen

+0

是的,已经有600个许可。 – Naveen

+0

好的 - 您是否检查了AWS控制台以确保密钥与服务器匹配? – ajtrichards