Create SSH Keys. You shall be prompted for a passphrase (I would recommend putting in a passphrase, at least it would still be secure if someone get hold of your SSH Keys).
ssh-keygen -t rsa -f [FILENAME] -C "[NAME]"mv [FILENAME] [FILENAME].pem
Now you would have 2 files:
[FILENAME].pem
[FILENAME].pub
When created a new droplet, at the Add you SSH keys
section, click New SSH Key
. Copy the content of [FILENAME].pub
into SSH key content
and enter a Name
.
cat [FILENAME].pub
After a droplet is created, you can ssh into the server using the following command.
ssh -i [FILENAME].pem root@[SERVER_IP_OR_DOMAIN_NAME]
Note: remember to backup and secure the .pem
file and remember the passphrase.
Note: I prefer to use the above method to store my SSH keys in my own directory (for proper file naming and backup). You can also follow this tutorial which store SSH keys at default .ssh
directory.