Report this

What is the reason for this report?

SSH Setup for a Newbie

Posted on April 30, 2014

The workflow for setting up an SSH key is not totally clear for a newbie. I followed https://cloud.digitalocean.com/ssh_keys and created my key pair, but adding the public key to Digital Ocean is a little confusing. I am not able to copy the contents of the public key from the online console (copy/paste not available), and I am not sure what adding the key does. Can anyone explain this step-by-step without a lot of code. I looked at this and it also confused me: https://www.digitalocean.com/community/articles/how-to-set-up-ssh-keys--2 Note that I am trying to add SSH to an existing droplet. I have already created the key pair.



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

You should be a able to simply add your public key you to the authorized_keys file in your home directory /home/username/.ssh/authorized_keys file on your cloud server. You can either scp the file up to your cloud and add it it /home/username/.ssh/authorized_keys or even easier just copy the text of it an paste it into your /home/username/.ssh/authorized_keys (using vi or nano editor) on your cloud server. The main thing you have to remember is that your the .ssh folder and authorized_keys folder on the cloud server cannot be readable by anyone but your user or it will not work. You should set the permissions for /home/username/.ssh and authorized_keys to 700. Once this is done you should be able to ssh in without a password. If it doesn’t work try ssh username@host -vvv to get more information on the exact error and post here for more help.

Adding a SSH key allows you to access the droplet without having to use a password. It is also more secure as you can then disable password authentication all together. That way only the key can be used to access it, and someone won’t be able to use brute force attacks to try to login to your server. <br> <br>It sounds like you are generating the key on the droplet itself. What you actually need to do is create the key on your local computer, not the remote server. You then copy the public key to the server while the private key stays on you local computer. <br> <br>What OS are you using locally? If you’re using Windows, you might want to look into using PuTTY: <br> <br>https://www.digitalocean.com/community/articles/how-to-use-ssh-keys-with-putty-on-digitalocean-droplets-windows-users

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.