how do i regain ftp access if i deleted ssh keys from /etc/ssh

August 10, 2018 523 views
Apache DigitalOcean Security Ubuntu 16.04

I have a droplet on digital ocean.

As I had to revoke my old SSH keys, I first updated the /root/.ssh/authorized_keys with the new SSH key.

I then deleted the old keys from the file in /root

(this is the problem creating step, I guess..)
deleted the keys from /etc/ssh in my ubuntu server, thinking they were the SSHs keys I had generated earlier.
ps - I didn’t delete the config files - Sshconfig / sshimportid / sshdconfig / moduli.
I deleted sshhostrsakeypub / sshhostrsa_key and similar files for dsa / ecdsa / ed25519

Now I’m unable to connect to my server. How do I go about solving this issue?

I do have console access to the droplet and I have backups of the files I deleted from etc/ssh

1 Answer

Hello friend!

Fear not. Use our web console to do this. It’s not as responsive as SSH, you can’t paste into it, but it’s perfect for these emergency situations. What you need to do is generate new host keys. I have a guide for you here:

Kind Regards,

Have another answer? Share your knowledge.