Getting permission denied error when trying to SSH into my EC2 Instance

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:

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).
Mar 27, 2019 in AWS by Tushar
2,718 views

1 answer to this question.

0 votes

The problem is having wrong mod on the file. This can easily be solved by executing the following command:

chmod 400 mykey.pem

I found the solution from Amazon Documentation:

Your key file must not be publicly viewable for SSH to work. Use this command if needed:

chmod 400 mykey.pem
answered Mar 27, 2019 by Esha

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer

Permission denied when I SSH access to EC2 instance

These are common reasons that can cause ...READ MORE

answered Mar 12, 2019 in AWS by Reema
2,058 views
0 votes
1 answer
+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Cannot ping to my EC2 Instance

This problem mainly occurs because of the ...READ MORE

answered Mar 27, 2019 in AWS by Ritu
694 views
0 votes
1 answer

What happens to data once we terminate the EC2 Instance?

The data stored in local instance store ...READ MORE

answered Jan 31, 2019 in AWS by jagarnath
1,973 views
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