This article covers method to fix the error, ec2 key permission denied.
"Permission denied (publickey)" and "Authentication failed, permission denied" errors occur if:
- You're trying to connect using the wrong user name for your AMI.
- The permissions are incorrect on the instance.
- The incorrect SSH public key (.pub) file is in the authorized_keys file.
To fix this error, simply:
- Verify that you're using the correct user name for your AMI.
- Also Verify that the instance's permissions are correct and that the correct SSH public key is in the authorized_keys file.