I've been working with AWS for awhile and I am not sure exactly happened but after returning to my computer after a week away from AWS there is something wrong with my key pair permissions. Key pairs have never been an issue but when trying to SSH into EC2 instances, I am always getting one of two errors:
Failed to add the host to the list of known hosts
Followed by
Permission denied (publickey).
OR
I am prompted for an instance-specific password
Ironically, this comes after the initial prompt ensuring you want to connect. I've tried generating key pairs 3 ways.
1) AWS Console 2) At Launch 3) Terminal
I've imported keys and just tried using plain key pairs created in the console and if I don't get a public key error, I am prompted for a password for the instance which I do not have. I am currently preparing for an AWS certification exam so this is obviously a problem I've been dealing with for about a day now and I'm out of ideas troubleshooting wise.
Any help would be greatly appreciated.
ssh -v
? Obviously scrub sensitive data first. The messageFailed to add the host to the list of known hosts
points to a file permission issue on~/.ssh/known_hosts
on your local machine. It can usually be ignored but may point to other permission issues on your ssh directory which prevent the use of your keys when connecting. The verbose output will help diagnose that.-v
to the ssh command you use to connect to aws. i.e.ssh -v [email protected]