I created a droplet/VPS.

How can I view which of my SSH keys a VPS can use?

I added some SSH keys to my digitalocean account.

I created a droplet, I don’t recall which SSH keys I clicked the checkboxes for, for it to have access to.

How can I check?

At the moment the SSH key that I thought i’d “checked”/clicked the checkbox for the VPS to use, isn’t letting me in. So I can’t access my VPS.

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.

×
2 answers

I think the most you can do from the digitalocean site is view SSH keys added to your digitalocean account, https://cloud.digitalocean.com/account/security

The screen where you pick what SSH keys are associated with the VPS/droplet, is only there as a form you fill in for creating it. After that, you don’t get that screen, and you’re expected to be able to get into the VPS, ssh root@ip and from there you can see what SSH keys are added cat ~/.ssh/authorized_keys , standard SSH methods.

Hello,

You can check the ~/.ssh/authorized_keys file using the DigitalOcean console and see if your ssh-key is added in the file.

You can enable PasswordAuthentication for your Droplet by modifying your /etc/ssh/sshd_config file. Once set to Yes restart the SSH service and connect via an SSH client for a more stable connection. You can then modify your ~/.ssh/authorized_keys file to add the appropriate public key.

This should do the job for you as well.

The other option is to temporary enable the PasswordAuthentication from no to yes in order to access your droplet using password and then once you’ve entered your key to disable the PasswordAuthentication again. This way is considered more secure than uploading the key to a Dropbox in case you don’t have any other server to us.

  1. Login to the console on DigitalOcean website.
  2. Type sudo nano /etc/ssh/sshd_config
  3. Change PasswordAuthentication from “no” to “yes” and save the file
  4. 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
  5. Login with password
  6. Type sudo nano ~/.ssh/authorized_keys
  7. Paste public key text here and save the file
  8. Type sudo nano /etc/ssh/sshd_config
  9. Change PasswordAuthentication from “yes” to “no” and save the file
  10. Log out and attempt to log back in (if using PuTTY make sure you set up auth parameters to point to your private key)

Hope that this helps!
Regards,
Alex

Submit an Answer