key1 Scenario

To log into “Server A” from “Server B” without using passwords. Users for both the server will be “root”

Process

 Login to “Server B” as root user and generate key for the root user. No need to enter any passphrase while generating this key.


ssh-keygen -t rsa

 

Once the key is generated, copy the contents of “Server B” /root/.ssh/id_rsa.pub to “Server A” /root/.ssh/authorized_keys file. Make sure that the permission of authorized_keys is 0600 and .ssh folder is 0700 .

Also make sure that you have the following lines in your /etc/ssh/sshd_config file: 
RSAAuthentication yes
PubkeyAuthentication yes

Finally restart your ssh service and try logging to your “Server B” from “Server A”:


/etc/init.d/sshd restart

ssh [Server_A_ip]