Report this

What is the reason for this report?

How do i add an ssh key to an existing droplet?

Posted on November 22, 2014

Hello,

I have been trying to add a public key on a pre-existing droplet and I am not able to connect although I have tried to paste it on the original SSH KEY, and on a new key. I have followed this https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets tutorial, but it is not really showing it well on how i can get into a preconfigured drop-let.

Thank you



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!

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.

btw, i dont sure if my message sent…

I got it to work by adding the ssh key to both /root/.ssh/authorized_keys and /root/.ssh known_hosts then restarting the droplet

The following have worked for me:

  1. Create GitHub repo and put your key in it
  2. Clone the repo using console
  3. Run cat /path/to/cloned/github/project/key | cat >> ~/.ssh/authorized_keys

NB key is a file containing the id_rsa.pub value

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.