Question

Why My SSH Key won't work?

So, I’ve set up quite a few SSH Keys, but my latest key doesn’t seem to be working. I’ve done what I’ve always done; copied the key directly from ~/.ssh/id_rsa.pub and pasted it into the Key(s) section on the Security Page in my DigitalOcean account panel.

This is the second key i’ve added, the first key still works. I’ve even tried restarting the service (even though I’ve never had to do that before).

I’m sure it’s my fault, something like I’ve just forgotten a simple step…

[USER]@[DROPLET-DOMAIN]; Permission denied (publickey).

Show comments

Submit an answer

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.

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.

You comment is correct, the key(s) installed on the droplet only happen on creation - adding new keys is not retroactive.

If you want to add the new key, you would add the private jey contents to your authorized_keys file, normally found here:

~/.ssh/authorized_keys

For root user, that is /root/.ssh/authorized_keys - it should already exist with the key it was assigned on creation. Copy the private key contents, the same that you pasted into the web cloud UI, and add them to the end of that file - then it should work.

Hope this helps and good luck!

Hi @TacticalDeveloper,

This error means the server actually reads the SSH key but finds some issues with it.

I’ll recommend checking THIS article on possible solutions.

Kind regards, Kalin