I have a running EC2
instance that is running Linux OS
(Amazon Linux AMI release 2018.03
) on it.
Given that Windows 10
has SSH
client available in the command prompt, I was trying to SSH
into my EC2
instance using the SSH
private key(.pem
file) provided by AWS
as a key pair during the setup of the EC2
instance.
The command I am using on cmd
is :
ssh -i private_key.pem [email protected]
Here private_key.pem
is the name of the private key file provided by AWS
.
But I keep getting the error:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions for 'private_key.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 "private_key.pem": bad permissions
[email protected]: Permission denied (publickey).
Some things I would like to clarify:
There are similar questions on StackOverflow. Those questions actually involve trying to connect to the
EC2
instance from a host that is runningMacOS
/Linux
(anyUNIX
based OS). In my case I am trying to connect fromWindows
10 host using command prompt.In answer to such other questions as discussed in (1), people have suggested trying to change the file permission of the private key file(
.pem
) file to read-only(chmod 444 file.pem
). In response, I tried making my.pem
file as read-only from the file properties in myWindows
. This did not help. I keep getting the same error.I am able to connect to other remote Linux hosts from my Windows 10 cmd, which suggests there is probably no problem with my Windows 10 SSH client.
I know this connection can be made easier by using
Putty
instead ofCMD
, but that is not what this question is about. Just assume because of some constraints I cant usePutty
.
Any help would be appreciated.