ssh : Permission denied (publickey)

January 19, 2018 12.5k views
Security Ubuntu 16.04

Dear !!

I created droplet 2 weeks ago.
I followed the using ssh guide, creating ssh key, adding ssh key for security on digitalocean.
I have logined the system everyday since setup.

But Today I try . : ssh root@IP address, I found the following message.
Permission denied (publickey).

I searched all question, but not working.

Please help me.

1 comment
  • I created droplet today but i can't access with ssh.
    when i run: ssh user@ip_addr
    it return Permission denied (publickey).
    what can i do to solve that?

7 Answers

I had same issue couple days ago. My problem was name of public key, I just rename public key to id_rsa and it works again.

Try with ssh -vvv root@IP address and see what is your problem with login.

  • When I try this command : ssh -vvv root@IP address,

    the result is below.

    debug2: key: /Users/happy/.ssh/idrsa (0x7fe651412070), explicit, agent
    debug3: send packet: type 5
    debug3: receive packet: type 7
    debug1: SSH2
    MSGEXTINFO received
    debug1: kexinputextinfo: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
    debug3: receive packet: type 6
    debug2: service
    accept: ssh-userauth
    debug1: SSH2MSGSERVICEACCEPT received
    debug3: send packet: type 50
    debug3: receive packet: type 51
    debug1: Authentications that can continue: publickey
    debug3: start over, passed a different list publickey
    debug3: preferred publickey,keyboard-interactive,password
    debug3: authmethod
    lookup publickey
    debug3: remaining preferred: keyboard-interactive,password
    debug3: authmethodisenabled publickey
    debug1: Next authentication method: publickey
    debug1: Offering RSA public key: /Users/happy/.ssh/idrsa
    debug3: send
    pubkey_test
    debug3: send packet: type 50
    debug2: we sent a publickey packet, wait for reply
    debug3: receive packet: type 51
    debug1: Authentications that can continue: publickey
    debug2: we did not send a packet, disable method
    debug1: No more authentication methods to try.
    Permission denied (publickey).

Do you have multiple ssh-keys on your computer?
you might wanna check if you have added your ssh key to your agent with 'ssh-add -L'

I'm having a very similar experience, except I'm not sure I ever managed to log in! Everything ends in Permission denied (publickey). e.g.

ssh-copy-id oolong@[my IP address]
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Permission denied (publickey).

I'm using Mint, fwiw.

  • Thanks for your advice.

    Did you manage the problem?
    I have a same result, "Permission denied (publickey)."

    Sincerely.

    • Probably, it can be useful to know.

      If you copy private key on to you PC, for instance, after system reinstall, make sure that you have added key correctly.

      ssh-add ~/.ssh/id_rsa

  • I'm getting the same thing. I'm running Ubuntu with Ruby on Rails. Trying to connect via iTerm on mac.

Meets the same issue , anyone who has solved it ?

We are getting same issue since few days. Anyone found solutions?

I have the same problem.
I tried everything in digitalocean

rothmann doesn t work

Have another answer? Share your knowledge.