Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
Adding a SSH key with new Recovery Console
I have a new laptop, so I wanted to update my SSH key that I use for my droplet. I generated a new key with
ssh-keygen on the new PC, and initially followed a DigitalOcean tutorial to update my SSH Key in their Settings > Security menu on the Dashboard.
I found out later that this only affects new droplets, and that I needed to update
~/.ssh/authorized_keys on my droplet. However, I could not connect with any of my old accounts as I would get
Permission denied (publickey). and no longer have access to that key.
The next advice I found was to use the web console on the Dashboard to update the keys file on my droplet. When I launched the Recovery Console (the only console I could find) I encountered strange red glitches you can see here and eventually a singular blinking cursor that did not respond to interaction or input.
But wait, this is where things get interesting! If I went to the Recovery tab on the droplet dashboard, selected Recovery ISO, rebooted, and was able to use the Recovery Console to do things like mount the disk, reset root password, update files, and more. I happily updated
~/.ssh/authorized_keys by using
curl to grab my new ssh key I stored on a bin website then copying it into the file. I had to do that because pasting into the web console did not work correctly.
Finally, I restarted my droplet, making sure to boot to disk directly instead of the Recovery ISO. The exact same problem still happens.
Strangely, I can connect using the new ssh key while I am still in recovery mode, although I get a
WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! that if I push through I can log on like normal. I am guessing that the recovery ISO does not save changes to the disk for this reason.
So, I don’t know what to do. If the web console worked outside of Recovery ISO, I could fix it, but I cannot. Any ideas to fix this would be amazing!
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.×