am not able to ssh to Amazon AWS from my kali nethunter device nexus 6p I get this error public key denied.
However I can easily ssh from my desktop without any issues, computer that has kali linux directly installed.
Here is the error.
──(root💀kali)-[/sdcard/Download]
└─# ssh -i kali-cloud.pem ec2user@ec2-x-x-x-x.us-east-2.compute.amazonaws.com
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@
Permissions 0660 for ‘kali-cloud.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 “kali-cloud.pem”: bad permissions
ec2user@ec2-x-x -x.us-east-2.compute.amazonaws.com: Permission denied (publickey).Kindly suggest.
Regards
Skorp
Answer
Private keys should be go-rw and public keys should be go-w at least.
In other words, permission 0660 is bad. chmod go-rw or 0600
Note also that the parent directory must also not be writable to anyone but the owner, so it should be 700 or 750
The reasoning here:
- A private key is pretty useless if it is readable to others.
- Both public key or private key are pretty useless if they can just be rewritten by others, either directly, or by replacing the file in the directory.
It would be a security hole to not ignore them when either of these is possible.
Attribution
Source : Link , Question Author : Skorp , Answer Author : user10489