This blog explains how to make passwordless connection in the remote computers using SSH for the beginners.
What is SSH?
It is an abbreviation for secure shell, a very common way to access remote Linux servers.It provides very strong authentication and encrypted data communication.I am using a VM to show how to connect local machine and remote machine in a very simple way.
We need to open remote machine and get the IP address of it. Here I am using Fedora on both the remote and local machine.
Let's install ssh before getting into it.
We need to install server and clients ssh in both the machines.
type $ sudo dnf install -y openssh server and let it get installed.
then type $ sudo dnf install -y openssh clients .
Now we are ready to follow the steps.
1. Login to root user (in both the machines) to avoid prompting password.
We can do this using command # systemctl enable sshd
We are enabling sshd so that whenever we restart the machines, ssh starts automatically.
And doing so start sshd using similar command # systemctl start sshd
Just to be sure that it is working fine, you can check status using # systemctl status sshd
It should return the result as following.
It will prompt you for remote's password. Enter it and your connection has been established.
But to make the password-less connection we need to use the shh key. Once the connection is made using ssh key, you won't require password to log in.
To generate a ssh key, Type # ssh-keygen in your local machine.
Now you are ready to establish the password-less connection. Just try to log in using
# ssh root@<ip_address_of_remote> and if you have followed the steps correctly,it won't prompt you for a password. MISSION SUCCESSFUL!
IN THE NEXT BLOG WE WILL LEARN ABOUT ANSIBLE AND WE WIL SEE HOW TO CONNECT MULTIPLE REMOTE MACHINES TO THE CONTROLLER AND ACCESS THEM ALL USING ONE COMMAND.
i