How to Create SSH Keys for Linux

How to Create SSH Keys for Linux

An SSH key is an access credential utilized for the SSH protocol. Its function is similar to that of user names and passwords, but the keys are primarily used for accessing servers via the command line.

Create SSH Key

To create and SSH key on Linux we can use the command ssh-keygen.


After pressing enter you will then be promted with the question to name the location of the file.

Enter file in which to save the key (/home/me/.ssh/mykeyname): 	

Now it is time to select a password for your SSH key. This password will be asked for when the key is utilized in the future. If you do not want a password for the key, simply leave it blank.

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

When you have finished entering your password, a public and a private key will be created.

Your identification has been saved in /home/me/.ssh/mykeyname
Your public key has been saved in /home/me/.ssh/
The key fingerprint is:
SHA256:dzE12DVnHlqX47/nukMyVkZJs6KQirNp0D4GDEjFkl0 me@fedora
The key's randomart image is:
+---[RSA 3072]----+
| .=..E       +=**|
|oo o     .  ..*O=|
|o .     o   +oo o|
| o . . . . . +o. |
|  + + . S o .o  .|
|   + +   . .+ . .|
|    B      . +  .|
|   o .        ...|
|              o=o|

The newley created key is now located in the ~/.ssh under the name the name you specified, mykeyname and

Add SSH key to key-ring

To be able to use the SSH key we should add it to the key-ring. We can do so with the following command.

ssh-add ~/.ssh/mykeyname

To use the public key you can simply copy

cat ~/.ssh/
Freddie Freddie 2 days, 2 hours ago 0
Did you enjoy Freddie Freddie's article?
How to Create SSH Keys for Linux
Login to Comment
No comments have been posted yet, be the first one to comment.