First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:a@A:~> ssh-keygen -t rsa
a@A:~> ssh b@B mkdir -p .ssh
Finally append a's new public key to b@B:.ssh/authorized_keys and enter b's password one last time:
a@A:~> cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys'
From now on you can log into B as b from A as a without password:
A note from one of our readers: Depending on your version of SSH you might also have to do the following changes:
- Put the public key in .ssh/authorized_keys2
- Change the permissions of .ssh to 700
- Change the permissions of .ssh/authorized_keys2 to 640