Question

How can I add a new SSH to my server?

Posted February 27, 2020 143 views
Security

I’m new to this, when I created my DigitalOcean “project” it allowed me to enter an SSH key, it works great!

Now I want to add an SSH key for another computer, but I don’t see an option anywhere for that :(

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.

×
1 answer

Hello, @jouo

You can follow out tutorial in order to generate a new ssh-key locally on your computer or any other PC and then upload it to your droplet:

https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys–2

  1. You need to generate the key using the ssh keygen command:
ssh-keygen -t rsa
  1. Once this is done you can simply copy the idrsa.pub key file to the authorizedkeys file on your droplet using this command:
cat ~/.ssh/id_rsa.pub | ssh demo@IPaddress "mkdir -p ~/.ssh && chmod 700 ~/.ssh && cat >>  ~/.ssh/authorized_keys"

Hope this helps!

Regards,
Alex

by Etel Sverdlov
SSH keys provide a more secure way of logging into a virtual private server with SSH than using a password alone. With SSH keys, users can log into a server without a password. This tutorial explains how to generate, use, and upload an SSH Key Pair.
Submit an Answer