To connect to the authorized client machine, we generate the SSH keys which are unique and can connect to the host machine after entering those unique SSH keys into the client machine. So, in this blog, we will explore a method by which we can generate the SSH keys on Ubuntu.
First, we will make sure that the SSH server is installed on both the client and host machine. If it is not installed, install it first by following our dedicated installation guide.
To begin with the generation of SSH keys on Ubuntu, we will start with the client machine. First, verify whether there are keys already generated or not. To verify, use the command typed below:
In the above figure, we can see that there is no directory which means that there is no SSH keys on the client machine, so now we will generate the SSH key on the client machine using the command:
When you run the above command:
Once the key is generated, the next step is to verify the generation of SSH keys by running the command:
So, it has displayed the SSH keys file.
Now, to copy the SSH keys on the machine to which we want to connect remotely(host). For this, we should know the IP address as well as the username of that machine. In our case, the user name is “hammad”, the ip address is “10.0.2.15”:
It will ask you to enter the password of the remote(host) machine; enter the password and hit “Enter”:
The SSH keys are successfully copied to the Host machine.
Finally, we will connect with the machine, using the command:
As you can see, we are signed into the machine.
If you want to disable the identification method, then simply open the “ssh_config” file in the client machine using the nano text editor:
Find out the line “PasswordAuthentication ” and then changed the “Yes” with “no”:
Exit from the file and reload the service of ssh using the systemctl command:
The service is reloaded and status can be verified using the option of status with the systemctl command:
The SSH server is used to connect with the other machines remotely and to have a secure connection with them, we generate the SSH keys on Ubuntu 22.04. In this blog, the method of generating the SSH keys on Ubuntu has been explained.
The Cybersecurity Maturity Model Certification, or CMMC for short, is a security framework for protecting…
Software supply chain security has become a top concern for developers, DevOps engineers, and IT…
Welcome to the Ubuntu Weekly Newsletter, Issue 894 for the week of May 25 –…
Qualys discovered two vulnerabilities in various Linux distributions which allow a local attacker with permission…
This is a follow-up to the Extended Support warning sent one month ago to confirm…
Here’s a detailed step-by-step guide demonstrating how to install Coroot on Ubuntu VPS. What is…