Generating your SSH key on Unix-like systems
Generating an SSH key on Linux and OS X is easy; they come with a built-in tool to do this, called ssh-keygen
.
How to do it…
In the following steps, we will create an SSH key for your Unix system:
First, we are going to check whether you have any SSH keys present. Open your terminal and enter the following command:
$ ls ~/.ssh
If you have a file named
id_rsa.pub
orid_dsa.pub
, you can skip this recipe.To generate a new SSH key, you need to open your terminal and enter the following command:
$ ssh-keygen -t rsa -C "Comment for key"
The comment can be anything you want; it makes it easier for you to see which key it is when you open the key file.
Now, we get to the question of what you want to name your key. Just press Enter.
You will be asked to enter a passphrase. Enter it, and be sure to choose a strong password.
You should see the following screenshot:
Your SSH key is now generated.
How it works…
We just created our personal SSH key: one key is the id_rsa...