SSH (Secure Shell) is an encrypted protocol for connecting to a remote device. By default, it runs on TCP port 22. There are two ways to connect to a remote server using SSH, one using password authentication and the other using a public key. In this guide, we will learn how to generate an SSH key that will be used for key-based authentication in CentOS 8.
Create SSH Key
Before generating an SSH key. First, make sure SSH is installed or not. To verify, open a terminal and enter the following command.
# ssh –V
After checking the ssh package. Now I am going to generate an SSH key using the following command.
To increase security, you can specify an encryption algorithm to suit your needs, as shown below.
# ssh-keygen –t rsa # ssh-keygen –t rsa –b 4096
After entering the above command, the following output should appear.
To save the file in the suggested directory, click to come in,
Then he will offer you to enter the passphrase, leave it blank and press the enter key. The following output should appear.
SSH key created successfully. You can verify this with the following command to view your SSH key.
This command will print your SSH key.
In this guide, we learned how to create an SSH authentication key in CentOS8. We also saw how to generate an SSH key using a special encryption algorithm.
How to generate an SSH key in CentOS 8