ssh : Permission denied (publickey)

Posted January 19, 2018 135k views
SecurityUbuntu 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?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
13 answers

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 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
    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).

When I created my very first droplet, I encountered the same error.

The solution was:

  1. Generate a keypair in localhost using “ssh-keygen” and press <Enter> for the rest.
  2. Add a public key to your account settings with name “”.
  3. Create the droplet after <1>. Make sure to check the checkbox to use existing pub key.
  4. After droplet creation, log in as usual “ssh root@<droplet_ip>”

Hope it helps.

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

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.

Meets the same issue , anyone who has solved it ?

I have the same problem.
I tried everything in digitalocean

rothmann doesn t work

have same problem , any news? i copy the pub key i generated via git bash then i did ssh root@etc but dosnt work… says same Permission denied (publickey) for root

Same issue. when trying with ssh root@ip_add, it says Permission denied (publickey).

Previous 1 2 Next