How to Upload SSH Public Keys to a DigitalOcean Account

DigitalOcean Droplets are Linux-based virtual machines (VMs) that run on top of virtualized hardware. Each Droplet you create is a new server you can use, either standalone or as part of a larger, cloud-based infrastructure.

After you create an SSH key, you can upload your public key to your DigitalOcean account to make it easier to add your keys to your Droplets. It's safe to freely share your SSH public key because it cannot be used to re-create the private key. It can only be used to validate the user who holds the associated private key.

From the Account section in the navigation menu, select Security. In the SSH keys section, click Add SSH Key.

DigitalOcean add new key button

Next, copy your public key, which should end in .pub into your clipboard and paste the contents into the SSH key content field. Windows users who generated their key pair with PuTTYgen need to use PuTTYgen to view the public key in the appropriate format.

In the second field, enter a name for the key that will help you identify the in the DigitalOcean interface. This is often the name of the machine you copied the public key from.

DigitalOcean new public key prompt

Click the Add SSH Key button when you are finished. The key is displayed on the Security page. You can use a key's More menu to edit the key information or delete it entirely:

DigitalOcean new public key prompt

Now when you create a Droplet, you can automatically embed this key by selecting it in the Add your SSH keys section of the Droplet create page.

If you are familiar with creating servers through DigitalOcean, you may be used to receiving an email upon creation with the authentication details and password. When you choose to embed an SSH key into a new server, you will not be sent an email. Instead, you will use your private key to sign in. If you set a password on the key itself when you created it, you will be prompted for the key's password. If not, you'll connect with no additional authentication.