Technology
How to Generate SSH Keys: A Comprehensive Guide for Different Platforms
How to Generate SSH Keys: A Comprehensive Guide for Different Platforms
SSH keys provide a secure, password-free method to authenticate and log into remote servers. This guide will walk you through the process of generating SSH keys using both OpenSSH and PuTTYgen, two of the most popular tools. Whether you are using a Linux or macOS workstation, or a Windows machine with Windows 10, this guide will help you get the job done.
Why Use SSH Keys?
SSH keys significantly enhance security by eliminating the need for repetitive password entry. Unlike usernames and passwords, which can be easily guessed or stolen, SSH keys are more secure. They are stored in a secure format and require a passphrase for added protection. This guide will show you how to generate and use SSH keys effectively.
Generate SSH Keys Using OpenSSH
OpenSSH is the standard and should be present on macOS and most Linux distributions. For Windows users, we provide installation instructions for Windows 10. Follow these steps to create an SSH key using the OpenSSH utilities:
Open a terminal or command prompt window and generate your key with ssh-keygen, substituting your email address as the comment field:
ssh-keygen -t ed25519 -C @
Note: If your legacy system doesn't support the Ed25519 algorithm, use:
ssh-keygen -t rsa -b 4096 -C @
By default, the keys are stored in the ~ directory. The default filenames used by most SSH clients are:
AlgorithmPublic key filenamePrivate key filename ED25519id_ed25519id_ed25519 RSAid_rsaid_rsa DSAid_dsaid_dsa ECDSAid_ecdsaid_ecdsaPress Enter to save the key in the default location.
Generating public/private ed25519 key pair.
You may enter a passphrase for your key. We recommend using a passphrase to protect your key as it will be prompted each time you use the key. If you prefer to bypass this prompt, you can press Enter.
Enter passphrase (empty for no passphrase):
Enter the same passphrase again for confirmation:
Enter same passphrase again:
Your key is generated and saved.
Your identification has been saved in id_ed25519.
Your public key has been saved in id_
The key fingerprint is: SHA256:qx6prR4ZoVU7Fl8yivXzzzzzzzzJ/9NRnPbrC20w7g example@
Make a backup of the private key. The key cannot be recovered if lost.
Before connecting to an existing server, you will need to add the public key to the authorized_keys file on the server. You can also add the public key to your Vultr account for future use.
Install OpenSSH on Windows 10
The OpenSSH client is an installable component for Windows 10 1809. Follow these steps to install it:
Launch Settings then go to Apps Apps and Features Manage Optional Features.
Scan this list to see if OpenSSH Client is already installed. If not, click Add a feature.
Locate OpenSSH Client and click Install.
Optionally, you can also install OpenSSH Client with PowerShell.
Once you’ve installed OpenSSH, follow the instructions above to create your SSH key.
Create an SSH Key on Windows with PuTTYgen
PuTTYgen is part of the PuTTY suite of utilities and is available for all versions of Windows. Follow these steps to create an SSH key with PuTTYgen:
Download the latest version of the PuTTY utilities. We recommend the MSI Windows Installer package.
Install the package and run PuTTYgen.
Select EdDSA for the key type and set Ed25519 255 bits in the lower-right corner.
Click the Generate button, then move the mouse in the blank area to generate some random data.
Enter a Key comment to make the key easier to identify later.
The private key must be kept secure. We recommend entering a Key passphrase to protect the SSH key.
Click Save private key and store it securely. This file is your public/private key pair in PuTTY format. You can re-import this file with PuTTYgen to export or convert the format of your public key.
Click Conversions Export OpenSSH key and save this file securely. This file is your private SSH key in OpenSSH format. You may need this file if you use an SSH client other than PuTTY.
Select the text in the Public key for pasting into OpenSSH authorized_keys file box and save it to a file. This is your public key in OpenSSH format. If you want to add this key to your Vultr account, you will also copy and paste this into the Customer Portal.
SSH keys are a fundamental security measure for remote server access. By following this guide, you can easily generate, manage, and use SSH keys on your preferred platform. Secure your digital life and protect your online presence with SSH keys.