Trying to SSH into an Amazon Ec2 instance - permission error

后端 未结 29 3426
一生所求
一生所求 2020-11-27 08:51

This is probably a stupidly simple question to some :)

I\'ve created a new linux instance on Amazon EC2, and as part of that downloaded the .pem file to allow me to

29条回答
  •  迷失自我
    2020-11-27 09:26

    I know this question has been answered already but for those that have tried them all and you are still getting the annoying "Permission denied (publickey)". Try running your command with SUDO. Of course this is a temporary solution and you should set permissions correctly but at least that will let you identify that your current user is not running with the privileges you need (as you assumed)

    sudo ssh -i amazonec2.pem ec2-xxx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com

    Once you do this you'll get a message like this:

    Please login as the user "ec2-user" rather than the user "root"

    Which is also sparsely documented. In that case just do this:

    sudo ssh -i amazonec2.pem ec2-xxx-xxx-xxx-xxx.us-west-2.compute.amazonaws.com -l ec2-user

    And you'll get the glorious:

       __|  __|_  )
       _|  (     /   Amazon Linux AMI
      ___|\___|___|
    

提交回复
热议问题