In this blog post, I will show you how to log in to a Linux machine without using a username and password and use SSH key authentication to log in.
SSH key authentication offer a safe and secure method to login to Linux hosts without compromising security.
In this case, I have a local machine which is my laptop and a target machine which is my Linux host.
Create SSH Key Pairs
The first step in this process is to create SSH Key pairs on my local machine. The command below will create private and public keys.
When you run the command, you can use the default key name (id_ssh) and location (home/user/.ssh/).
Next, we will copy the public key (the key with the .pub extention at the end.
Copy Public Key to The Target Machine
Since I have access to my target machine, I will run the following command, connecting to it and copying the public key to the .ssh folder.
Just remember that the private key should stay on the local machine.
ssh-copy-id -i /home/user/.ssh/rsa_id.pub firstname.lastname@example.org