1. A机上运行:ssh-keygen -t rsa
2. A机上运行:scp /root/.ssh/id_rsa.pub B:/root/.ssh/authorized_keys
3. C机上运行:ssh-keygen -t rsa
4. C机上运行:scp /root/.ssh/id_rsa.pub root@IP:/root/.ssh/ IP (其中IP是B机的)
5. 登录到B机,进入/root/.ssh下
6. B机上运行:cat IP >> authorized_keys.
至此,A,C机都可无需密码登录到B机上了,其他的同样设置。