Secure Shell Getting started with Secure Shell Creating your SSH key


You can create your ssh key using ssh-keygen, it's a program that is part of the ssh installation. To do so just run it and follow the instructions on screen.

Here's an example:

$ ssh-keygen
Generating public/private rsa key pair.

The default directory where you ssh key pair will be saved is inside the .ssh folder in your home directory (you can change this by specifying a valid path) and the default name for the keypair is id_rsa for the private key and for the public key:

Enter file in which to save the key (/home/nasreddine/.ssh/id_rsa): /home/my_folder/my_ssh_key

You can protect your SSH key from unauthorized use by entering a password. This is optional but it's recommended that you use a passphrase. Note that, like with any other command program, when entering your passphrase it will not show anything on screen but it is being recorded:

Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Once you enter your passphrase ssh-keygen will generate a key and save it to the path you chose:

Your identification has been saved in /home/my_folder/my_ssh_key.
Your public key has been saved in /home/my_folder/

We're done. Now our ssh key is ready for use.

enter image description here