Question

Access droplet with ssh key

I’m trying to access my droplet through cmder with an ssh just set up in digital ocean, but get the message “root@droplet ip: Permission denied (publickey)”. How do I get through?


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

alexdo
Site Moderator
Site Moderator badge
October 2, 2022

Hello @sub359

You can also check this tutorial on how to add your ssh key to an already existing droplet

https://docs.digitalocean.com/products/droplets/how-to/add-ssh-keys/to-existing-droplet/

Regards

KFSys
Site Moderator
Site Moderator badge
October 2, 2022

Hi @sub359,

Well, it seems like that for some reason your Droplet can’t match a your public and private keys.

The first option would be that you need to add the SSH key on your Droplet. To add the SSH key, on your laptop, copy the contents of your id_rsa.pub file, you’ll need to place it on the Droplet, in ~/.ssh/authozired_keys. To get access you can check this link:

https://docs.digitalocean.com/products/droplets/how-to/recovery/recovery-console/

The other option would be that when you try to SSH to your Droplet, your Key is not loaded. What you can try to do is:

  1. ssh -i /path/to/ssh/id_rsa.pub root@IPAddress

See if that works. Where /path/to/ssh/id_rsa.pub is the actual path to your SSH key.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.