Once you have a Digitalocean account, you can add an SSH key to your account. Then, Digitalocean will assist you by adding your public SSH key to the server, so that when you go to log in as the initial root user, you can be allowed in based on your private key.

First, click Settings in the bottom left of your control panel, then hit the Security tab.

do add ssh

Click that Add SSH Key button to open the add SSH Key dialog.

do add ssh new

Paste your public SSH key into the box. We used an id_ed25519 key in our create an SSH key tutorial.

We could find this public key by browsing to it in the file explorer, or concatenating it to the command line and copying and pasting.

cat ~/.ssh/id_ed25519.pub

get our public ssh key

Now we can paste that public key into the Digitalocean form. We use the email as the name of the key.

do ssh added

Then we hit Add SSH Key. Now we can see the key in our Digitalocean security settings.

do ssh add done

All done! Now, whenever we create a server on Digitalocean, we can automatically have this public key added for our root user.