Make sure A's .ssh/authorized_keys has the public key of B, .ssh/id_rsa.pub, and has permissions 600.
Make sure B's .ssh/authorized_keys has the public key of A, .ssh/id_rsa.pub, and has permissions...