Question

Dont work, Add SSH keys after Droplet created

Posted December 11, 2020 719 views
Linux Basics

Hello Digital Ocean,

I am César I have three droplets over Linux with password authentication, and I really like to add SSH key auth.

Today I generated my public key by putty key generator but I have not found the option to add this public key to the droplets for using ssh key auth.

I really appreciate your help

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

Hello @cesarfarro

So you will need to login to the server via the password authentication and paste the public key into ~/.ssh/authorized_keys on a new line

Some guides

Regards

Simon
Founder - SnapShooter DigitalOcean backups

SnapShooter - DigitalOcean Backups

by Etel Sverdlov
by Brian Boucheron
SSH keys provide a more secure method of logging into a server than using a password. With SSH keys, users can log into a server without a password. This tutorial explains how to generate, upload, and use an SSH key pair, and optionally how to disable password-based SSH authentication.

Hello, cesarfarro

You can double check this tutorials on how to create and upload SSH Keys with PuTTY on Windows:

https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/create-with-putty/

https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/to-existing-droplet/

If you’re using a SSH-client the following command with upload the keys for you and you’ll just need to enter your username password:

cat ~/.ssh/id_rsa.pub | \
ssh username@203.0.113.0 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

Hope that this helps!
Regards,
Alex