Login SSH without password

Sometimes working on projects, you will have the need to login from this Linux machine to another Linux machine using SSH without having to enter a password to do some automated tasks as your needs, for example: copy a file … This tutorial, I would like to guide you to do this!

The condition is that the two machines have to install SSH 😀

Let’s say we have two virtual machines with the following IP addresses:

Login SSH without password

and

Login SSH without password

Now, I want from 192.168.59.157 login to 192.168.59.150 without having to enter a password, I will do the following:

First, on 192.168.59.157 I will generate a public key and a private key using the ssh-keygen tool by entering the following terminal:

Result:

Login SSH without password

Then, I will copy the public key file id.rsa.pub which created in the ~/.ssh/ folder of 192.168.59.157 machine to the 192.168.59.150 machine using the ssh-copy-id tool by entering the command line:

In this example, I would enter the following:

Login SSH without password

That’s it, now to log into 192.168.59.150 machine, I just enter:

Login SSH without password

Add Comment