I restored from a snapshot and now my ssh is prompting for a password?

Posted December 7, 2016 3.7k views
DigitalOceanUbuntu 16.04

SSH config has password authentication as no, and it was ok until i restored a previous snapshot, i deleted the known host record also.

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

In most cases, selecting the correct key on the droplet creation page will insert it into the new droplet on creation. This process depends on cloud-init so if any changes affected that it could potentially result in what you’re seeing. Either way, if you open a ticket with our support team they can boot your droplet to a recovery ISO (Debian based live dvd image) and from there you can manually add your key to /root/.ssh/authorized_keys Once you’ve added your key manually, update your ticket and the support team can remove the recovery image so you can boot back to your disk.

  • Correct me if I’m wrong, but he can just go to Web Console and do that without Support team and Recovery ISO (nothing bad for Support, they’re epic :D).

    Only downside is that you can’t copy key in Web Console window but you can find work around like temporary enabling password or downloading it from somewhere.

I had (have) the same issue. When restoring an image that already had ssh keys configured, if I ask for an SSH key to be included (the same one already there), it’s no longer possible to use the SSH key to log in. If I don’t include it, then I get an email with a new root password, which defeats the purpose of using password-less SSH, and in fact in my scenario is not usable, since I have disabled root logins and password.

I’d like to know how to do this properly without having a new password set.

  • OK, in my case, it turned out to be a setting in the sshdconfig file. I also learned that if an ssh key is added on snapshot restore, the authorizedkeys files is reset with only the newly added key and any previous keys will be gone.