An SSH key pair is very useful when you want to more securely give, or get access to a server from another server or computer. This will allow the connecting computer to authenticate using a check(comparing) of keys in stead of password. The key pair consists of two keys:

Public key (The lock)
Usually named, where .pub means public. Think of the public key as your lock. To be able to identify with your key (the private key) you need to install your lock on the server you want to connect to. It's also harmless to share your lock with the world, as long as you keep your key secret.

When you want to be able to authorize using keys then it's the public key you want to install with the server, or send to the people maintaining the server so they can add it for you.

Private key (The key)
The private key is named the same as your public key, but without .pub. Think if it as the key to your lock(the public key). This should be kept safe.

Do not share your private key with anyone!

Some systems does make a key pair for you and suggest you install it on your computer, like cPanel, which is fine as long as you only use those keys to authenticate with the cPanel server that made them.

How to make a key pair
From the computer or server you want to make a key pair for run the following command
ssh-keygen -b 4096
The parameter -b sets the key length to 4096 bits. The more bits, the more secure. But overdoing the length can slow down the authentication proccess, since longer keys means more bits that needs to be processed. We recommend 4096, but standard for most systems is 2048.

After the first command is run you will be prompted with an option to enter the file in which to save the key. If you don't already have a key you can press enter (use the default file and location).

Then you will be prompted with the option of adding a passphrase (password) to the key. This is highly recommended for personal keys! But can make it hard to make server to server automatic authentication work. If no passphrase press ENTER.

When using ssh keys to migrate a site to Servebolt the passphrase should be empty

Enter the passphrase again (or just hit ENTER if you left it empty).

The keygen will now display a randomart which is a human readable version of your keys just used when a human want to compare the public and the private key.

You're done. You have now made a key pair

How to read the public key

To read a public key we recommend using the cat command.

cat ~/.ssh/

Replace with the keyname for the public key you want to view. is the standard for most systems.
Was this article helpful?
Thank you!