A机器(001) cd ~/.ssh

ssh-keygen -t rsa 三次回车

生成的密钥发送到B服务器

scp id_rsa.pub username@ip:~/.ssh

在B机器:

cd ~/.ssh

cat id_rsa.pub >>authorized_keys