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 13.126.141.194 -i key123.pem
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
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 13.126.141.194: Permission denied (publickey).

How can I solve this error?

Jun 3, 2020 in AWS by akhtar
• 38,260 points
8,073 views

1 answer to this question.

+2 votes
Best answer

Hi@akhtar,

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,460 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,020 points
5,749 views
+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,020 points
962 views
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
1,986 views
0 votes
2 answers
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