Friday 2 December 2016

Password less authentication in linux

Source : host A
Destination: host B


1. Run the below command for generating public and private key( host A)

ssh-keygen -t rsa

/home/username/id_rsa (private key)
/home/username/id_rsa.pub (public key)

2. ssh-copy-id -i  /home/username/id_rsa.pub host_B_ip_address



Alternate way:

* Copy the text inside id_rsa.pub file .

* Login into host B and go to /root/username/

and create new file "authorized_keys" and paste text copied from step 2.

*  Login into Host A to Host B password less.(ssh host B)


Simple:

Put public key(host A) to authorized_keys(host B)

Now Host A can login into host B without any password.