AWS ssh error: Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

 I was ssh-ing to AWS EC2 instance and got the error Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

-----------------

sh-3.2# chmod 400 ec2-keypair.pem
sh-3.2# ssh ec2-suer@54.89.86.26 -i ec2-keypair.pem
The authenticity of host '54.89.86.26 (54.89.86.26)' can't be established.
ECDSA key fingerprint is SHA256:LoSxZtmn3jyNZikgW6U50z3owgBM/Gm/pnK0aJNmScQ.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '54.89.86.26' (ECDSA) to the list of known hosts.
ec2-suer@54.89.86.26: Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
sh-3.2# ssh ec2-user@54.89.86.26 -i ./ec2-keypair.pem
       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|
https://aws.amazon.com/amazon-linux-2/
25 package(s) needed for security, out of 39 available
Run "sudo yum update" to apply all updates.
[ec2-user@ip-10-0-1-24 ~]$
-----------------

Solution: The solution is just adding the right path, for the key pair that you downloaded. I was in the right folder and I gave the path by just adding "./"

ssh ec2-user@54.89.86.26 -i ./ec2-keypair.pem



Comments

Popular posts from this blog

Opencart error: Notice: Trying to access array offset on value of type null in ..../vendor/scss.inc.php on line 1753

Creating Class Templates

Fixed: Opencart installation error linux: warning: fopen(system/storage) failed to open stream: Permission denied