2

I was connecting to an EC2 machine in AWS using the following command on the Windows' Linux Shell:

ssh -i AWSNV.pem ubuntu@<server_ip>

But last week I updated my Windows 10 and this command now returns this error:

WARNING: UNPROTECTED PRIVATE KEY FILE!

Permissions 0777 for 'AWSNV.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 "AWSNV.pem": bad permissions

Permission denied (publickey).

I've tried so far:

  • Using chmod 400 AWSNV.pem and chmod 600 AWSNV.pem (but the error continues)
  • Changing the owner myself, disabling inheritance and deleting all permissions (but I kept getting permission denied on the Linux terminal)

Does anyone have some insight on this issue?

  • 1
    It is not just the permissions on the file itself, but permissions on the directory that contains the file. Perms on the containing directory should be 0700 and either 0600 or 0400 on the key file itself. – ivanivan May 29 '18 at 19:49
  • nope, still getting the same error as the OP – Aaron Bramson Sep 4 '18 at 8:32
  • @ivanivan back in May I fixed the issue configuring the SSH using PuTTy from Amazon I think. But 2 weeks ago I solved the problem based on your feedback :) – henriqueberlesi Sep 6 '18 at 0:11
  • @AaronBramson check the solution out hope it helps – henriqueberlesi Sep 6 '18 at 0:19
1

My file was on my User's Desktop.

  • I fixed the problem by opening the Linux Bash in Windows and creating a file there:

  • henriqueberlesi@pc:~ nano

  • Putting the private key inside of the file.

  • Saved the file as myfile.pem

  • chmod 400 myfile.pem
  • ssh -i AWSNV.pem ubuntu@<server_ip>

Then it connected to the server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.