In this guide we are going to run through generating SSH key pairs to add to your server to allow SSH access.
Once your private key is generated, keep this private and never share it with anyone.
Using PuTTYgen on Windows
PuTTYgen is an SSH key generator tool for creating SSH keys for use with the PuTTY SSH client. The keys generated can also be used in other SSH clients. PuTTYgen can be used to create public and private key pairs in its own .ppk format. This tool can also be used to convert keys to other formats.
If you already have PuTTY installed, you should already have this tool, if not you can download it stand alone from here.
Once installed it should be accessible via Start menu, All Programs, PuTTY, PuTTYgen.
When opened you will be presented with the following screen:
To generate our new key pair, make sure RSA is ticked, leave the default number of bits at 2048, then click the generate button.
You will now see a green progress bar, move your mouse in random movements just under the green bar to generate a secure key.
Once complete you will be presented with your new key. Now enter a secure password for this key.
Click Save public key and Save private Key to save these to your local machine. Keep the copy of your private key safe in a known directory. Your public key what we require to be loaded on the new server/service with us to allow you access.
Creating SSH keys in Linux
To generate SSH keys within a Linux environment, you can use the ssh-keygen command.
Within the terminal type the following
ssh-keygen -t rsa
Enter the location where you would like to save the private key.
Enter file in which to save the key (/home/jamie/.ssh/id_rsa):
The public key will be saved in the same location, under the same file name, but with the .pub extension.
Now enter a secure password for the key.
The whole process should look similar to the following,
jamie@localhost: ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/jamie/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in id_rsa. Your public key has been saved in id_rsa.pub. The key fingerprint is: 09:f8:46:85:60:36:24:8c:1e:e6:e7:ae:9f:9a:27:72 jamie@localhost
Your new public and private key will be located at,
Last modified: 2021/09/14 at 13:51 by Jamie