Step 1
First log in on A pc and generate a pair of authentication keys. Do not enter a passphrase:
ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory '/home/a/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
...
Step 2
Copy authen file to remote host (host B)
ssh-copy-id -i .ssh/id_dsa.pub {hostB_ip/hostB_name}
Step 3
From nowyou can log into B as b from A as a without password:
a@A:~> ssh b@{hostB_ip/hostB_name}
Note :
Must Disable Security-Enhanced Linux
If still errors
Change the permissions of .ssh to 700
Change the permissions of .ssh/authorized_keys to 600