Secure Shell (also known as SSH) is a cryptographic network protocol. Ssh-keygen is a tool in the Linux distro that is used for creating new authentication key pairs for SSH. Such key pairs are used for automating logins, single sign-on, and for authenticating hosts. In simple word, ssh keygen allow a user to connect to a remote system without supplying a password
It is also used to transfer files from one computer to another computer over the network using a secure copy (SCP) Protocol.
In this tutorial post, we will show you how to set up and use password-less login on Linux/Ubuntu, RHEL/CentOS, and Fedora using ssh keys to connect to remote Linux servers without entering a password. By using Password-less login with SSH keys will increase the trust-relation between two Linux servers for easy file synchronization or transfer.
In this example, we will set up SSH password-less automatic login from server 192.168.1.101 as user sr to 192.168.1.102 with user server.
Note:- Username in First Server 192.168.1.101 is :- sr
Username in Second Server 192.168.1.102 is :- server
Step 1: Create Authentication RSA SSH-Keygen Keys on – (192.168.1.101)
First login into server 192.168.1.101 with user sr and generate a pair of public keys using the following command.
sr@vetechno:~$ ssh-keygen -t rsa
Use SSH from server 192.168.1.101 to connect server 192.168.1.102 using server as a user and create .ssh directory under it, using the following command.
Note:- Username in First Server 192.168.1.101 is :- sr
Username in Second Server 192.168.1.102 is :- server
sr@vetechno:~$ ssh [email protected] mkdir -p .ssh
sr@vetechno:~$ cat .ssh/id_rsa.pub | ssh [email protected] 'cat >> .ssh/authorized_keys'
sr@vetechno:~$ ssh [email protected] "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
Congratulations you have successfully generated RSA ssh keygen to login server without Passwords.
Related Search Queries