How to Generate SSH Keys

SSH access allows you to have ‘command line access’ to the server that houses your account. This allows you to have a secure, remote connection to your server and account. The SSH program allows you to use a password to connect, but it is easier and more secure to use SSH ‘keys’. These keys are a type of cryptographic challenge and response that have many advantages. Shown below are a few ways to generate some SSH keys of your own:

For Windows Users

  1. Open the PuTTYgen application. NOTE: If you don’t have PuTTYgen, you can download it from the PuTTY Download Page.
  2. Select key type For ‘Type of key to generate‘, select RSA.
  3. Determine number of bits For ‘Number of bits in a generated key‘, select 4096.
  4. Determine number of bits Click Generate.
  5. Click on Generate button Move your mouse pointer around in the Key section until the progress bar is full.
  6. Optional: Type a comment into the Key comment section to help with identifying this SSH key pair.
  7. Type key phrase Recommended: Type a secure passphrase into the Key passphrase field, and again into the Confirm passphrase field.
  8. save keys Finally, click the Save public key, and also the Save private key buttons, and name your keys. Be sure to save both keys in your user’s .ssh directory inside their home directory. For instance:

For OS X / Linux Users

  1. Open Terminal from your Application list.
  2. Type the following into the Terminal, and then hit Enter: ssh-keygen -t rsa -b 4096
  3. Press Enter again when you see a prompt to “Enter file in which to save the key“.
  4. When prompted, type a secure passphrase, and press Enter.
  5. When prompted, type the secure passphrase again to confirm, and press Enter.

You should see the following successful message containing the details that pertain to your key that was generated:

userna5@localhost ~ $ ssh-keygen -t rsa -b 4096
Generating public/private rsa key pair.
Enter file in which to save the key (/home/userna5/.ssh/id_rsa):  Enter passphrase (empty for no passphrase):  
Enter same passphrase again:  
Your identification has been saved in /home/userna5/.ssh/id_rsa. 
Your public key has been saved in /home/userna5/.ssh/ 
The key fingerprint is: SHA256:PRxLu/LU6ZfFDve1sTIR0nK86NJVYRxRONCz0N5oy7U userna5@localhost The key's randomart image is:
 +---[RSA 4096]----+ 
 |            .+.+=| 
 |            . *+ | 
 |          o oo.*.| 
 |         + * ==.o|
 |        S * =o++.|
 |           = =+E=|
 |        . = + .**|
 |         = + oooo|
 |          o ..o  |


Leave a Reply