UNPROTECTED PRIVATE KEY FILE Error using SSH into Amazon EC2 Instance AWS

0 votes

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

When I tried to ssh with:

ssh -i myfile.pem <public dns>

I got:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

Permissions 0644 for 'amazonec2.pem' are too open. It is recommended that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: amazonec2.pem Permission denied (publickey).

I tried to chmod +600 the pem file, but now when I ssh I just get:

Permission denied (publickey).

What error am I making here? The .pem file is in my home folder (in osx). It's permissions look like this:

-rw-------@ 1 mattroberts staff 1696 19 Nov 11:20 amazonec2.pem

Apr 25, 2022 in AWS by Aditya
• 7,680 points
765 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In AWS

+1 vote
2 answers
0 votes
1 answer

How to ssh into EC2 instance without PEM key?

You need ssh-agent to supply your PEM file during ...READ MORE

answered Mar 13, 2019 in AWS by trisha
1,679 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Unable to initiate ssh connection to Amazon EC2 instance

The keypair which you are using must ...READ MORE

answered Sep 5, 2018 in AWS by Archana
• 4,170 points
843 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP