Permissions for key123 pem are too open It is required that your private key files are NOT accessible by others

+2 votes

Hi Guys, 

I am trying to do SSH in my instance. But it is showing me the below error. 

C:\>ssh -l ec2-user -i key123.pem
Permissions for 'key123.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "private-key.ppk": bad permissions
ec2-user Permission denied (publickey).

How can I solve this error?

Jun 3, 2020 in AWS by akhtar
• 38,210 points

1 answer to this question.

+2 votes
Best answer


You got this error because you didn't set security for your key file. To avoid this error, you can follow the below given commands. Open power shell from your windows system and run all the given commands one by one.

$ $path=".\key.pem"
$icacls.exe $path /reset
$icacls.exe $path /inheritance:r
$icacls.exe $path /GRANT:R "$($env:USERNAME):(R)"

Hope this will solve your error.

answered Jun 3, 2020 by MD
• 95,320 points

selected Nov 17, 2020 by akhtar
Thanks, these commands did fix the issue
Hi, @There,

Glad that the solution given above helped you!!! Do UPVOTE the answer so that other techies around the globe can be helped to resolve their queries. Do posts any of your tech queries with the Edureka community!!!

Happy Learning!!!

Related Questions In AWS

0 votes
1 answer

Error creating Key Pair: You are not authorized to perform this operation

Try adding AmazonEC2FullAccess policy. If you are not sure how ...READ MORE

answered Sep 19, 2018 in AWS by Priyaj
• 58,140 points
+5 votes
2 answers

What are the different job roles that one can get for AWS

If you have the AWS certification for ...READ MORE

answered Sep 21, 2018 in AWS by Priyaj
• 58,140 points
0 votes
1 answer

Is there any certification required for an AWS pre-sales ?

The certification on AWS Architect (associate or ...READ MORE

answered Nov 30, 2018 in AWS by Aniket
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer