Monday, 8 August 2016

Unknown

PASSWORD-LESS CONNECTION USING SSH

                                             
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.





2. Get the IP address of the remote machine. You can get it using ' ip a '.





3. Before using IP address to make the connection, we will have to enable and start sshd on both the machines.
 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.





4. Now you are ready to make the connection. Just type # ssh root@<ip_address_of_remote>
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.





5. Upload the generated key to remote machine using  # ssh-copy-id <ip_address_remote> 
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.



Unknown

About Unknown -

FOSS enthusiast, Linux evangelist and a programmer heart and soul. In love with Python and C. I contribute to fedora project and seek opportunities to learn more.

Subscribe to this Blog via Email :