我正在尝试使用以下命令建立AWS Server ssh连接:
ssh -v -i abc-key-pair-nvirginia.pem admin@ec2-xx-xx-xx-xxx.compute-1.amazonaws.com (尝试root / ubuntu / ec2-user而不是admin)
记录跟踪:
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: abc@abc.com
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 :(得分:0)
如果您使用Ubuntu实例,请使用用户名ubuntu
。示例如下:
ssh -v -i abc-key-pair-nvirginia.pem ubuntu@ec2-xx-xx-xx-xxx.compute-1.amazonaws.com
如果失败,那么您需要检查您的实例是否已使用您使用的密钥对启动。
此外,请确保您的密钥文件具有正确的权限。您可以使用以下方式设置:
chmod 600 abc-key-pair-nvirginia.pem