Question

Add SSH key after creating a droplet

Hi There,

I did not add the SSH key before creating the droplet. Now my server is all set and is about to go live. I cannot setup another one but really need to add an SSH key.

Is there any way I could do that. Also I cannot se any droplet resize option available, any ideas why is that? I’m currently running LAMP on Ubuntu 12. 512 MB droplet.

Thanks.

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.

Andrew SB
DigitalOcean Employee
DigitalOcean Employee badge
May 14, 2014
Accepted Answer

To add a SSH key after the creation of the droplet, you need to add the contents of the public key to the file ~/.ssh/authorized_keys You can do that by running this on your local computer: <br> <br><pre> <br>cat ~/.ssh/id_rsa.pub | ssh root@your.ip.address “cat >> ~/.ssh/authorized_keys” <br></pre> <br> <br>You need to power down the droplet before you can resize it.

Exactly! I had to add an SSH key to an existing droplet but couldn’t log in via SSH because of “permission denied (publickey)” so all these instructions are not working if you disabled password login. I lost a lot of time trying to get access to my droplet from a new computer. The only solution was to get my old computer and log in from there with the old SSH key. The Digital Ocean console is completely non-functional. It just doesn’t work. If I paste in my SSH key it gets altered, upper-case letters become lower-case letters, the string is cut off in the middle etc. and it’s extremely slow and non-responsive. All in all a very frustrating experience!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel