How to solve the error with the message ‘Permission denied (publickey,gssapi-keyex,gssapi-with-mic)’ which appears when I am trying do a ssh in AWS instance ?

Example Error:

cmacedo-OSX:.ssh camilamacedo$ ssh -i my_pair_key.pem IP/DNS

Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Possible Situations

  • You’re not specifying the correct SSH keypair file or user name in the ssh command you’re using to log into the server:

    ssh -i [full path to keypair file] root@[EC2 instance hostname or IP address]

 

  • You don’t have the correct permissions on the keypair file; you should use $ chmod 600 [keypair file]
  • You forgot to use the user ‘ec2-user’ :

cmacedo-OSX:.ssh camilamacedo$ ssh -i my_pair_key.pem ec2-user@IP/DNS

**NOTE**: For you get more information add -v ( verbose ) in the ssh command.  

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s