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

July 1, 2016 116.5k views

ssh -v root@xx.xx.xx.xxx
OpenSSH6.9p1, LibreSSL 2.1.7
debug1: Reading configuration data /Users/frank
debug1: Reading configuration data /etc/ssh/sshconfig
debug1: /etc/ssh/ssh
config line 21: Applying options for *
debug1: /etc/ssh/sshconfig line 56: Applying options for *
debug1: Connecting to [] port 22.
debug1: Connection established.
debug1: identity file /Users/frank
szn/.ssh/idrsa type 1
debug1: key
loadpublic: No such file or directory
debug1: identity file /Users/frank
szn/.ssh/idrsa-cert type -1
debug1: key
loadpublic: No such file or directory
debug1: identity file /Users/frank
szn/.ssh/iddsa type -1
debug1: key
loadpublic: No such file or directory
debug1: identity file /Users/frank
szn/.ssh/iddsa-cert type -1
debug1: key
loadpublic: No such file or directory
debug1: identity file /Users/frank
szn/.ssh/idecdsa type -1
debug1: key
loadpublic: No such file or directory
debug1: identity file /Users/frank
szn/.ssh/idecdsa-cert type -1
debug1: key
loadpublic: No such file or directory
debug1: identity file /Users/frank
szn/.ssh/ided25519 type -1
debug1: key
loadpublic: No such file or directory
debug1: identity file /Users/frank
szn/.ssh/ided25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH
debug1: Remote protocol version 2.0, remote software version OpenSSH5.3
debug1: match: OpenSSH
5.3 pat OpenSSH5* compat 0x0c000000
debug1: Authenticating to as 'root'
debug1: SSH2
debug1: SSH2
debug1: kex: server->client aes128-ctr umac-64@openssh.com none
debug1: kex: client->server aes128-ctr umac-64@openssh.com none
debug1: SSH2
MSGKEXDHGEXREQUEST(1024<3072<8192) sent
debug1: SSH2
debug1: Server host key: ssh-rsa SHA256:xiB0VWociJ19y8/fqsxGcn0OJJeMe8J5TUhii5y05Ms
debug1: Host '' is known and matches the RSA host key.
debug1: Found key in /Users/frank
debug1: SSH2
debug1: expecting SSH2
debug1: SSH2
debug1: Roaming not allowed by server
debug1: SSH2
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/frank
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Trying private key: /Users/frank
debug1: Trying private key: /Users/frank
debug1: Trying private key: /Users/frank
debug1: No more authentication methods to try.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

1 comment
  • It's unclear what you're trying to do, as you haven't asked a question. What have you set up, and what are you trying to accomplish. If we know more about what you're working on, and what you've created, we can help you further. Thanks!

10 Answers

You may try edit in /etc/ssh/sshd_config
PasswordAuthentication yes

service sshd restart

  • Thanks, this totally worked btw, and I didn't have to even restart the service

  • Thanks It helped me.

    One thing i just want to share additional information here is
    try edit in /etc/ssh/sshd_config
    PasswordAuthentication yes
    in both source and destination machines

I found in messages log information about bad ownership of authorized_keys. So I changed permissions for my /home/USERNAME/.ssh/authorized_keys to 0600 and everything works.

Hi @ryanpq @nikfarid , I'm having the same issue.

I checked in Digital Ocean Console .ssh/authorized_keys and I have my key there. I did password authentication to Yes, even tried with no. (as someone suggested).

But still no luck, getting the same "Permission Denied (public Key)" issue.

Can you please help me on this.

Dilip Gupta

I am trying get SSH access from my Ubuntu 14.04 to Cent OS 7 droplet at digitalocean. But it's throwing error, "Permission denied (publickey,gssapi-keyex,gssapi-with-mic)."

Again, I am trying to access form filezila SFTP and it's throwing error:
"Disconnected: No supported authentication methods available (server sent: publickey,gssapi-keyex,gssapi-with-mic)"

I have generated SSH key form my Ubuntu Terminal by command: "ssh-keygen -t rsa" and uploaded / past the public key "id_rsa.pub" to my digitalocean droplet SSH key option.

While I first tried to access SHH connection it asked,
"The authenticity of host '1XXXXXXXX' can't be established.
Are you sure you want to continue connecting (yes/no)?
After I type Yes,
it's through the error, "Permission denied (publickey,gssapi-keyex,gssapi-with-mic)" .

Please advise how to fix it.

Without further information it is difficult to help you troubleshoot this. According to these logs, the keys on your local computer did not match the public keys on your droplet.

Have you been able to connect to this droplet via ssh before?

Have you used this key on your account with another droplet?

If you continue to have trouble and have not set up a password for your root user you can open a ticket with our support team who can assist you in setting a password to allow you to access the droplet from the console in the control panel in order to investigate or assist you in rebooting your droplet to a recovery environment where you can check that your public key was properly added to your /root/.ssh/authorized_keys file.

@Dilip7597 I have the same issue
I get Permission denied (publickey,gssapi-keyex,gssapi-with-mic). when trying to ssh through Terminal app.

I just got back from an extended winter holiday, but before the holiday (4-5 weeks ago) I used to ssh connect to my droplet without a problem. I have not changed the ssh keys since then, so it can't be a problem with that.

Be sure that the public key on /pathToUser/.ssh/idrsa.pub in the droplet is the same file than /pathToUser/.ssh/idrsa.pub in your local machine.

I have tried ALL of the above to zero avail

I had luck with the changing the above mentioned permissions on /home/USERNAME/.ssh/authorized_keys in conjunction with changing the permission on the parent ssh folder chmod 700 /home/USERNAME/.ssh

facing the same issue.
Using bash ubuntu for windows and I cannot login to the server.
If i use putty, I get right in

Have another answer? Share your knowledge.