Trying to SSH into an Amazon Ec2 instance - permission error

后端 未结 29 3506
一生所求
一生所求 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:20

    In addition to the other answers, here is what I did in order for this to work:

    • Copy the key to .ssh folder if you still hadn't:

    cp key.pem ~/.ssh/key.pem

    • Give the proper permissions to the key

    chmod 400 ~/.ssh/key.pem

    • Start ssh-agent (Thanks to https://stackoverflow.com/a/17848593 )

    eval `ssh-agent -s` ssh-add

    • Then, add the key

    ssh-add ~/.ssh/key.pem

    Now you should be able to ssh EC2 (:

提交回复
热议问题