Lost old SSH key for droplets. How do I add my new key?

My old hard drive failed, and I didn’t have a backup. I had to replace the HDD. I have now lost my old SSH key.

I need to add my new SSH key to my 2 droplets. These droplets have been live for over 6 months.

Is it possible?

Please do not suggest adding an SSH key that requires logging into the server. That’s impossible, as I don’t have my old SSH key.

What options do I have?

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 have two options. Unfortunately both will require some brief downtime for your droplets.

1.) Create a snapshot of the droplet and re-deploy it. If you power off your droplet, create a snapshot and re-deploy a new droplet from the snapshot you can add your key when the new droplet is created and get access to the new droplet with all your files and configuration in place (but a new IP address).

2.) Open a ticket with our support team. They can reboot your droplet to our Recovery ISO. This is a live Debian environment that will allow you to access your droplet via the console in the control panel, mount your disk and make any needed changes within your filesystem.

I would also recommend setting a root password on your droplet. If you are using key based authentication for SSH this will not change that but the password could be used in the console in the control panel in case of this type of problem. Since the console is considered by your droplet to be a local keyboard and display you can use your password there while only allowing key based authentication for ssh.

For anyone intend to turn off droplet and take snapshot:

The process is damn slow, wtf??? I’ve turned off my production server for 15 mins, it still not finish while I’m writing this comment.

I’d very much appreciate it if when I’m doing a Destroy => Reimage I had the option of adding additional ssh keys… :(