Deleting / Creating new SSH Keys

January 6, 2017 9.9k views
DigitalOcean Arch Linux


I created a rsa-ssh key about a week ago and was able to connect it perfectly.
Due to technical issues on my laptop I had to reset it to factory settings, and I forgot to save the rsa private key.

I am trying to create a new set of ssh keys. I deleted the current ssh keys and created a new set and added the new rsa pub key on digital ocean.

Nevertheless when trying to connect ssh it still would not work. I logged into the server via the DO console and did cat ~/.ssh/authorizedkeys. The outputted key was the old key, which surprised me since I thought DO was in charge of updating the authorizedkeys file when updating the SSH Keys on DO. So I deleted authorizedkeys and created a new one with the correct permissions (600) and typed the entire in it since clipboard is not enabled on your DO console. Still does not work. Now I can not delete the current SSH Key because of error Not Found on DO.

HELP! haha :)

2 Answers

Our system sets up ssh keys on your droplet when you first create it using cloud-init. Due to the way droplets are set up, we do not have access to your droplet’s filesystem once it’s created in order to update the key automatically. You’ll need to manually place your new key in the authorized_keys directory.

The correct file name is “authorized_keys” with the underscore.


chmod 700 ~/.ssh/
chmod 600 ~/.ssh/authorized_keys

  • Yep! That’s what I have, not sure where my underscore went, but the filename is authorized_keys.

    • Try to perform the inclusion of your public key by connecting to SSH using a password.

      Make sure password access is enabled in /etc/ssh/sshd_config

      PasswordAuthentication yes    # Must be yes
      PermitRootLogin yes   # Must be yes

      Make the changes on the server, and then change the settings above in the sshd_config file to “no.”

Have another answer? Share your knowledge.