
An SSH key allows you to log into your server without a password. This guide describes creating SSH keys using a Linux, Mac, or Windows workstation in OpenSSH format, suitable for use with Vultr server instances.
OpenSSH is standard and should be present on macOS and most Linux distributions. We also have installation instructions for Windows 10 users. Follow these steps to create an SSH key with the OpenSSH utilities.
Generate your key with ssh-keygen, substituting your email address.
Note: If you use a legacy system that doesn't support the Ed25519 algorithm, use:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
By default, the keys are stored in the ~/.ssh directory. Most SSH clients automatically use these default filenames:
Algorithm: ED25519 (preferred)
Algorithm: RSA (at least 2048-bit key size)
Algorithm: DSA (deprecated)
Algorithm: ECDSA
Press Enter to save the key in the default location.
You may enter a passphrase for your key. We recommend using a passphrase, but you can press Enter to bypass this prompt. If you use a passphrase, you will enter it each time you use the key unless you also use ssh-agent.
Your key is generated and saved.
Make a backup of the private key. The key cannot be recovered if lost.
Before connecting to an existing server with your SSH key, you'll need to add the public key to the authorized_keys file. You can also add the public key to your Vultr account.
The OpenSSH client is an installable component for Windows 10 1809.
Once you've installed OpenSSH, follow the instructions above to create your SSH key.
PuTTYgen is part of the PuTTY suite of utilities. It is available for all versions of Windows.
EdDSA for the key type.Ed25519 (255 bits).If you have access to the private key, you can recover the public key with OpenSSH.
Pass ssh-keygen the -y option and the path to the private key with the -f option. When ssh-keygen regenerates the public SSH key, you can redirect the output to a file of your choice.
For example, to regenerate the public key for ~/example_key and send the output to ~/example_key.pub:
If a password is set for the key, you will be prompted to enter it.
You can change the passphrase on a private key with the -p option and pass the key name with the -f option.
Enter your old and new passphrase (twice) at the prompts.
Print the key's SHA256 fingerprint with the -l option, and pass the key name with the -f option.
The output is something like this:
OpenSSH includes a utility to transfer a key to your server. When using this utility, you must authenticate to your server using SSH.
Specify the public key to be transferred with the -i option. Replace the example with your username and the server's IP address.
You will be prompted to authenticate with your server and transfer the key to the remote server's authorized_keys file.
OpenSSH 6.5 introduced ED25519 keys in 2014, and they are available on most operating systems. It's believed that ED25519 keys are more secure than RSA, with better performance. If you use an RSA key, the US National Institute of Science and Technology recommends a key size of at least 2048 bits.
For more information about managing SSH keys, see our other guides:
0 Comments
Be the first to comment and share your perspective with the community.