Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connecting to Amazon EC2 Instance on Windows 10 bash - Permission denied (publickey) [closed]

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?

like image 325
Khaled Elsherbiny Avatar asked Oct 19 '25 04:10

Khaled Elsherbiny


1 Answers

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.

like image 57
Acro Avatar answered Oct 21 '25 01:10

Acro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!