To login host B as user b from host A as user a through SSH without password, we have to configure host B to trust connections from host A.
In host A,
ssh_keygen -t rsa -b 2048
Copy the public key to host B as
~/.ssh/authorized_keys, and done.
p.s.
ssh-copy-id