Even though SSH login is protected by using passwords for the user account, we can make it more secure by using key-based authentication into SSH.
To see how key-based authentication works, we will need two Linux systems (in our example, both our Ubuntu systems). One should have the OpenSSH server package installed on it.
To use key-based authentication, we need to create a pair of keys—a private key and a public key.
On the client or local system, we will execute the following command to generate the SSH key-pair:
ssh-keygen-t rsa
The output obtained will be as follows:
While creating the key, we can accept the default values or change them as per our wishes. It will also ask for a passphrase, which you can set as anything or else leave it blank.
The key-pair will be created in the location—
~./ssh/
. Change to this directory and then use the command—ls –l
to see the details of the key files:We can see that the...