Question

How to access to Droplet If private Key is Lost

Posted July 5, 2015 8k views
UbuntuServer OptimizationSecurityConfiguration ManagementDeployment

How I will access to droplet if I loose my private key. I am running Ubuntu 14 and Given “No” to Password Authentication.

Please help me understand that what I have to do if I loose my private Key

1 comment

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.

×
Submit an Answer
2 answers

You have two options,
if you have a system user with a password set (even though SSH Password Auth is off) then you can use the Web Console to access it, as this is like accessing the server physically and thus only supports passwords.
Your other option is the Recovery Kernel (or Recovery Distro, for which you have to ask Support to enable this for you)
The Recovery Kernel you can enable yourself, you can mount your partitions and add your new Public key using this. Use this guide, for how to enable this kernel, the fsck stuff is unrelated: https://www.digitalocean.com/community/tutorials/how-to-recover-from-file-system-corruption-using-fsck-and-a-recovery-iso

Hello,

In this case, you would need to log in via the web console available in your DigitalOcean Cloud account area for that droplet.

Much more info can be found here:

https://www.digitalocean.com/docs/droplets/resources/console/

In order to enable Password level authentication, you can follow these steps.

  1. Type sudo nano /etc/ssh/sshd_config
  2. Change PasswordAuthentication from “no” to “yes” and save the file
  3. Open a terminal on your computer and type ssh username@[hostname or IP address] or if on a Windows box use PuTTY for password login making sure authentication parameters aren’t pointing to a private key
  4. Login with a password
  5. Type sudo nano ~/.ssh/authorized_keys
  6. Paste public key text here and save the file
  7. Type sudo nano /etc/ssh/sshd_config
  8. Change PasswordAuthentication from “yes” to “no” and save the file
  9. Restart the ssh service: sudo systemctl restart sshd

Regards,
Alex