How to Setup SSH Password-less Authentication in Linux

How to Setup SSH Password-less Authentication in Linux

Here; In this article, we are going to learn how to set up passwordless authentication between two Linux machines. This setup is very useful because after setting up we don't need to provide a password every time while logging in to the remote host

A. Create a new user on both the machines with the same name and create a new password for them( if a user with the same name is already available then just set up the password )

$ sudo adduser <username>
$ sudo passwd <username>

B. Now we have to make some changes in the sshd_config file

$ sudo vi /etc/ssh/sshd_config

C. Make the following changes on the remote host machine.

PasswordAuthentication yes

# Restart sshd
$ sudo systemctl restart sshd

D. Now generate the ssh key on the local host machine using ssh-keygen.

$ ssh-keygen

E. Copy the ssh public to a remote host using ssh-copy-id on the local host.

$ ssh-copy-id <remote-host-IP>

F. That's it, Now try to ssh the remote host.

$ ssh <remote-host-IP>

Conclusion:

We learned how to set up passwordless authentication between two Linux machines in a simple and straight-forward way. if someone has doubts can ask in the comment section or can reach out on LinkedIn (All social handles are listed on the top).

Thank you!!!!

Did you find this article valuable?

Support Pranav Thorve by becoming a sponsor. Any amount is appreciated!