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 in AWS by Tushar
330 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 by Esha

Related Questions In AWS

0 votes
1 answer
0 votes
1 answer
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 in AWS by Ritu
65 views
0 votes
1 answer