I am having problems with my key pairs and likely SSH permissions as I can no longer SSH into my EC2 instances.
I execute the following command:
ssh -i /Users/Matt/Downloads/private-key.pem ec2-user@XX.XXX.XXX.XXX
Keep in mind I just created this key pair in the AWS Management Console which downloaded the key .pem file to my downloads file. I then get the following error message after replying "yes" to continue connecting.
Failed to add the host to the list of known hosts
(/Users/Matt/.ssh/known_hosts).
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/Matt/Downloads/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 "/Matt/Downloads/private-key.pem": bad permissions
Permission denied (publickey).
Ok so I've spent the better part of a day troubleshooting this and have tried retrieving the pub file, importing that as a key pair, etc. and still I get permission denied (public key) or am prompted for a non-existent instance associated password. I am fairly certain this must be an issue with my own SSH permissions but I am lost.
This is what I get in the terminal after an ssh -v
usage: ssh [-XXXXXXXXXXXXXXX] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-E log_file] [-e escape_char]
[-F configfile] [-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport] [-l login_name] [-m
mac_spec]
[-O ctl_cmd] [-o option] [-p port]
[-Q cipher | cipher-auth | mac | kex | key]
[-R [bind_address:]port:host:hostport] [-S ctl_path] [-W host:port]
[-w local_tun[:remote_tun]] [user@]hostname [command]
Any help would be sincerely appreciated.