To connect to an EC2 instance over SSH, if the permissions on your .pem file are too broad then you’ll see this error:
Permissions 0644 for ‘keypair.pem’ are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
chmod the .pem file to 0400 and then you should be good. This is described here.
The chmod 400 does not solve the issue in my case.
D:\6 AWS\AWS Certified Developer – Associate (June 2018)
λ ls -la
-rw-r–r– 1 Arend 197121 1692 Jul 20 10:25 MyNewKeyPair.pem
λ chmod 400 MyNewKeyPair.pem
D:\6 AWS\AWS Certified Developer – Associate (June 2018)
λ ls -la
-r–r–r– 1 Arend 197121 1692 Jul 20 10:25 MyNewKeyPair.pem
λ ssh ec2-user@35.157.189.183 -i MyNewKeyPair.pem
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for ‘MyNewKeyPair.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 “MyNewKeyPair.pem”: bad permissions
ec2-user@35.157.189.183: Permission denied (publickey).
On Windows, Google for this error message and you’ll find suggestions how to fix, eg: https://superuser.com/questions/1296024/windows-ssh-permissions-for-private-key-are-too-open
Hi Kevin, that worked for me on Windows. Thank you for thw advice