If you need to login from a serverA to a serverB using no password.
First what you have to do is login to a serverA as a user to generate a pair of authentication keys.
Do not enter a passphrase!
user@serverA:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa):
Created directory '/home/user/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/id_rsa.
Your public key has been saved in /home/user/.ssh/id_rsa.pub.
The key fingerprint is:
Now use the ssh to create a directory ~/.ssh as a user “user” on a serverB. The directory may already exist there, in this case do not create that directory:
user@serverA:~> ssh user@serverB mkdir -p .ssh
Finally copy a new public key to user@serverB .ssh/authorized_keys and enter the userB password the last time:
user@serverA:~> cat .ssh/id_rsa.pub | ssh user@serverB 'cat >> .ssh/authorized_keys'
From now, you can login to a serverB as a user “user” from a serverA without typing a password.