Newly downloaded .pem key file giving error while connecting to aws server


$ ssh -i /Users/experimental/.ssh/EC2DefaultPrivateKey-us-east-1.pem [email protected]
Warning: Permanently added xx.xxx.xxx.xxx' (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/experimental/.ssh/EC2DefaultPrivateKey-us-east-1.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 "/Users/experimental/.ssh/EC2DefaultPrivateKey-us-east-1.pem": bad permissions
[email protected]: Permission denied (publickey).
MacBook-Pro-6:~ experimental$ 

1 Answer

5 years ago by

If you closely look at the log, following is the error

Permissions 0644 for '/Users/experimental/.ssh/EC2DefaultPrivateKey-us-east-1.pem' are too open.

run the following command to fix it

chmod 400 ~/.ssh/EC2DefaultPrivateKey-us-east-1.pem
5 years ago by Karthik Divi