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.

×
13 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’

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

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 “id_rsa.pub”.
  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.
Vu

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

Same issue. It used to be successful at the first time. But then ends up the same issue.

Hello there. Any updates with this question?
I ran into the same issue today.
I have used my ssh key for few weeks.. and it worked fine. But today I can’t enter to my droplet.
I use ssh root@<droplet_ip> and every time get Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Even if I use ssh root@<droplet_ip> -i path/to/my/key it doesn’t work.
I checked everything. I checked that ssh-add -L gets my public key and file on droplet /root/.ssh/authorized_keys (through browser Console access) has the same value. Seems everything is ok. But it doesn’t work now. I don’t know why. Maybe the problem on my side… but what exactly?

  • Today I finally fixed it.
    I entered on droplet through Control Access via browser. And then changed on server file /etc/ssh/sshd_config next lines:
    1) PasswordAuthentication yes
    2) PermitRootLogin yes
    3) PubkeyAuthentication yes
    4) AuthorizedKeysFile .ssh/authorized_keys

    And then restarted sshd by : systemctl restart sshd

    Now it works.. I don’t know why it happened and is my solution safe for droplet.. but it works.

Hello,
Don’t forget modes and ownership in source and destination:

0700 user:user for .ssh
0644 user:user for .ssh/authorizedkeys and .ssh/knownhosts
0600 user:user for .ssh/id_rsa

It’s very important and if is not like that you may have this error

Submit an Answer