4

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?

Community
  • 1
  • 1
Khaled Elsherbiny
  • 223
  • 1
  • 3
  • 10

1 Answers1

9

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.

Acro
  • 156
  • 6
  • 2
    Thank you so much. It worked for me on Linux (Through VM). It seems that I can't use the Ubuntu bash anymore on Windows 10 to access to my EC2 Instance. I – Khaled Elsherbiny Aug 21 '16 at 00:10
  • You can do this by simply going to mykey.pem -> properties -> security -> advance -> remove all users in "Permission Entries" -> add only the user you need to connect from -> Disable Inheritance -> Give full permission – IndikaM Mar 31 '21 at 03:46