Unable to ssh into ec2 instance: WARNING: UNPROTECTED PRIVATE KEY FILE! Permissions 0555 for '.pem' are too open

After I created an ec2 instance, I tried to ssh into the port by using the private key, but even though I chmod the key down to 400, I get this error.

vagrant@ubuntu-bionic:/vagrant$ chmod 400 ./itmo-544-2019.pem
vagrant@ubuntu-bionic:/vagrant$ ssh -i ./itmo-544-2019.pem ubuntu@<ip-address>
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0555 for './itmo-544-2019.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 "./itmo-544-2019.pem": bad permissions
ubuntu@18.205.191.197: Permission denied (publickey).

I made sure the private key starts with

-----BEGIN RSA PRIVATE KEY-----

and ends with

-----END RSA PRIVATE KEY-----

I also tried chmod 600 ./itmo-544-2019.pem. But this didn't help either.

Any idea why?

2 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like