The following steps can be used to ssh from one system to another without specifying a password.
Step 1. On the client run the following commands:
ssh-keygen -t rsa
The output will look like this:
[email protected]:~# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
cd:1c:6b:4e:01:1d:8c:02:40:24:24:95:02:dc:12:7f [email protected]
Step 2. Now run the following commands:
ssh [email protected] mkdir -p .ssh
You will prompted for the password.
Step 3.Now run:
cat .ssh/id_rsa.pub | ssh [email protected] ‘cat >> .ssh/authorized_keys’
You will prompted for the password again.
From now on you can log into B as b from A as a without password.