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.
The standard OpenSSH suite of tools contains the ssh-keygen
utility, which is used to generate key pairs. Run it on your local computer to generate a 2048-bit RSA key pair, which is fine for most uses.
The utility prompts you to select a location for the keys. By default, the keys are stored in the ~/.ssh
directory with the filenames id_rsa
for the private key and id_rsa.pub
for the public key. Using the default locations allows your SSH client to automatically find your SSH keys when authenticating, so we recommend accepting them by pressing ENTER
.
If you have previously generated a key pair, you may see a prompt that looks like this:
If you choose to overwrite the key on disk, you cannot authenticate using the previous key anymore. Selecting yes is an irreversible destructive process.
Once you select a location for the key, you are prompted to enter an optional passphrase which encrypts the private key file on disk.
If you enter one, you have to provide it every time you use this key (unless you are running SSH agent software that stores the decrypted key). We recommend using a passphrase, but you can press ENTER
to bypass this prompt.
This is the last step in the creation process. You now have a public and private key that you can use to authenticate.
From here, you can: