I’m trying to connect in one of my EC2 instances, but I get the below error:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic)
It seems that the problem is OpenSSH, but I couldn’t find any solution.
Open SSH version:
Has anyone else faced this problem? Also, I tried this solution but it didn’t work.
It looks like the server prohibits password authentication.
A couple of things here to remember - the default username is “fedora” and the key you used should be associated with that user. Are you logging in as fedora@
<ec2 ip address>
$ ssh email@example.com
firstname.lastname@example.org: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
$ ssh email@example.com
Last login: Wed Jan 6 21:31:36 2021 from 0.121.188.74
I created this EC2 instance for testing purposes and I haven’t set any password.
Why does it try to connect with a password?
This is how I try to connect:
ssh -i "redis-test.pem" ec2-user@ec2-....eu-west-2.compute.amazonaws.com
This EC2 instance is using Amazon Linux 2. According to AWS, the user name should be
ec2-user. Am I missing something?
Ah. Amazon Linux 2 is a different operating system. It’s not published by the fedora team here. If you are using the Fedora AMI, then the default username is fedora. If you are using CentOS, the default name is centos Amazon recommends a standard username of ec2-user, but as a community, we don’t see that as the right option for our general purposes and want to remain consistent across all platforms. Amazon Linux is different in that it is purpose-built for Amazon EC2.
If you are still having difficulty logging into this or any other instance, you might want to verify the signature of the key you are using. Keep in mind that Amazon EC2 verifies by md5 hash and not by the default hash. You can follow the instructions provided by Amazon in the documentation linked here. If they match, then I would use a verbose logging for the ssh command to review all of the details