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.
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 can add an ssh key to an existing droplet by appending the public key (
ssh-rsa ...
) to/home/user/.ssh/authorized_keys
or/root/.ssh/authorized_keys
.If you’re on Linux, you can run the following command to do that automatically:
On OSX, you can run this command instead:
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:
NB key is a file containing the id_rsa.pub value