Password less authentication between linux servers

Password less authentication between linux servers:-
Source server:-192.168.2.11
Target server:-192.168.2.12

Hostfile entry On both source and target server:

cat /etc/hosts
192.168.2.11 server1.soumya.com server1
192.168.2.12 server2.soumya.com server2

On source server:-

# ssh-keygen -t rsa
# ssh-keygen -t dsa
# cd /root/.ssh
# cat id_rsa.pub >>authorized_keys
# cat id_dsa.pub >>authorized_keys
# scp authorized_keys root@server2:/root/.ssh/

On target server:-
# ssh-keygen -t rsa
# ssh-keygen -t dsa
# cd /root/.ssh
# cat id_rsa.pub >>authorized_keys
# cat id_dsa.pub >>authorized_keys
# scp authorized_keys root@server1:/root/.ssh/


Now lets test if both servers can ssh each other w/o password or not:-

on source server:-
[root@server1 ~]# ssh server2
Last login: Fri May 29 08:32:06 2015 from 192.168.2.50

[root@server1 ~]# ssh server2 date
Fri May 29 08:37:28 IST 2015


on target server:-

[root@server2 ~]# ssh server1
Last login: Fri May 29 08:38:00 2015 from server2.soumya.com

[root@server1 ~]# ssh server1 date
Fri May 29 08:38:14 IST 2015

So we can see both servers can connect each other without prompting for any password.

Happy learning...




Please share your ideas and opinions about this topic.

If you like this post, then please share with others.
Please subscribe on email for every updates on mail.

Nenhum comentário:

Postar um comentário

Related Posts Plugin for WordPress, Blogger...