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
- Open the PuTTYgen application.
- For 'Type of key to generate', select RSA.
- For 'Number of bits in a generated key', select 4096.
- Click Generate.
- Move your mouse pointer around in the Key section until the progress bar is full.
- Optional: Type a comment into the Key comment section to help with identifying this SSH key pair.
- Recommended: Type a secure passphrase into the Key passphrase field, and again into the Confirm passphrase field.
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: C:\Users\userna5\.ssh\id_rsa.pub
If you don't have PuTTYgen, you can download it from the PuTTY Download Page.
NOTICE: The public key can be copied from the Key field to Add an SSH Key for Self-Managed VPS.
For OS X / Linux Users
- Open Terminal from your Application list.
- Type the following into the Terminal, and then hit Enter: ssh-keygen -t rsa -b 4096
- Press Enter again when you see a prompt to "Enter file in which to save the key".
- When prompted, type a secure passphrase, and press Enter.
- 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/id_rsa.pub. 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 | +----[SHA256]-----+
NOTICE: "Your public key has been saved in /home/userna5/.ssh/id_rsa.pub". The text in this file is the public key that you will need to Add an SSH Key for Self-Managed VPS.
NOTE: If you are unable to locate this file simply type in cd ~/.ssh to navigate to your .ssh folder then ls -alh to list all files in that directory.