Connecting to Amazon EC2 Instance on Windows 10 bash – Permission denied (publickey)

I am trying to connect to my Amazon EC2 Instance using bash on Windows 10. I have already downloaded MyKey.pem It show me this message

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0555 for 'MyKey.pem' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: MyKey.pem
Permission denied (publickey).

While searching I found this issue Trying to SSH into an Amazon Ec2 instance – permission error but didn’t help me. I almost followed every single step on Amazon Documentations with no results again.

I tried to change the mode of the key using and didn’t work out with me

chmod 400 MyKey.pem

I also tried to connect using PuTTy but it tells me server refused our key and shows me this

PuTTy Fatal Error

How do I fix this?

ANSWER: Seems you’re storing key file at your usual filesystem. By default Windows 10 don’t accept creating 400 permissions at /mnt/driveletter/blablabla. If you’ll try to do that it’ll automatically switch to 555. If you want to configure 400 permissions, you can transfer key file to emulated Linux filesystem. For example to /home/username and run chmod 400 key.pem. After that ssh to AWS should work as usual.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.