Tutorial: Making an SSH Keypair

SSH Keys are critical to ensuring the safety of your server. SSH keys are a key pair that is made between your computer (or client machine) and your server. The server will connect if it sees the private key on your computer matches with the public key on the server. While a simple password can eventually be cracked, an SSH key is nearly impossible to decipher. 

 

Step One. Create RSA Key Pair and Store the Keys

First you need to create the key pair on your computer. There are two different ways you can do this: 1) manually using the Terminal window (Mac OS only) or 2) using a Key generator program like PuTTyGen (Windows OS only). Instructions for both of these methods is shown below:

For Mac Users:

Manually using the Terminal window

a. Type in the following command in the Terminal window and press ENTER:

 This will start the key generation process. The ssh-keygen will then prompt you to select where you would like to store the key.

b. Press the ENTER key to select the default location (make a note of this locaton so you don't forget it). The keygen utility will then prompt you to enter a passphrase. 

c. Type in a passphrase ( You can also simply hit ENTER to proceed without a passphrase however we do not recommend this). Jot down your passphrase someplace you won't forget.

d. Enter in the passphrase a second time to continue on. After confirming your passphrase your key pair will be generated. The entire process looks like this:

Your Private key is the id_rsa file; in this case it is located in the .ssh file directory. Your Public key is the id_rsa.pub file; in this case it is also located in the .ssh file directory.

To copy your SSH Public Key, type in "cat ~/.ssh/id_rsa.pub" into the terminal window. Next, copy and paste the terminal output into TextEdit and save as a .txt file.

Your Public key is the one you will upload into your BH Cloud account in a future step.

 For Windows Users:

Windows Users: Using PuTTygen 

First, make sure you have downloaded the PuTTy program. You can download the program here.  After downloading the PuTTYgen program, go to your Windows start menu in the bottom lefthand corner of your screen and type in "PuTTYgen" into the search bar (PuTTygen is a part of the PuTTy installation package). To generate a key with PuTTygen, simply open the application and follow these instructions:

 a. Start the puttygen.exe generator. 

b. In the Parameters section choose SSH-2 RSA and press Generate

c. Move your mouse randomly in the small screen to generate the key pairs. You should now have a screen that looks like this:

d. Type in a passphrase and type it in again to confirm it. Write down this passphrase somewhere you won't forget it. 

e. Click the "Save private key" to save your private key.

f. Click the "Save public key" to save your public key.

Your Public key is the one you will upload into your BH Cloud account in a future step. Before exiting the PuTTYgen program, highlight and copy  the characters in the space below the "Public key for pasting..." section.  DO NOT copy the end of the character string that looks like "rsa-key-XXXXXXXX".

After copying the characters, paste them into the Windows Notepad program and save the file as id_rsa.txt. These are the characters you will be pasting into the BH dashboard.

 

Step Two. Paste the Public Key

 While creating your new server instance (see Creating Your First Server), click the "Add Keypair" button to enter in your new Keypair. Type in a name for your Keypair. In the section labeled "New Keypair's Public Key", copy/paste the Public Key you previously generated and saved as a .txt file.

 

Step Three. Create your New Server

After you have entered in your new Keypair, it is time to finish selecting your server preferences and create your new server instance (click here for details on how to create your first server).

See graphic below for how your newly created Keypair works to provide access to your server:

 

 

 

Step Four. View Key Pairs in Admin Panel 

 You're finished! You can view your new Keypair in your Project Admin Panel by clicking the "Keypairs" button in the Cloud Computing section. 

 

 

You can also create a new keypair within your Project at any time by clicking the "+ Create" button in the Keypair panel and following the same process.

 

 

If you need additional help or have more questions our team is happy to help! Simply visit beyondhosting.net/support.

Posted in Learning Center on Sep 20, 2016