第一步:master节点
ssh-keygen -t rsa
cd .ssh/
ls
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ls -l
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/59c3e88ce3a7fb8d0dd6cd516ed3c773.png)
[zkpk@master .ssh]$ chmod 600 ~/.ssh/authorized_keys
[zkpk@master .ssh]$ ssh-add id_dsa
[zkpk@master .ssh]$ scp ~/.ssh/authorized_keys zkpk@slave01:~/
[zkpk@master .ssh]$ scp ~/.ssh/authorized_keys zkpk@slave02:~/
第二步:slave01节点
先从root用户退回到普通用户zkpk
[zkpk@slave01 ~]$ ssh-keygen -t rsa
shell [zkpk@slave01 ~]$ mv authorized_keys ~/.ssh/
第三步:slave02节点
先从root用户退回到普通用户zkpk
[zkpk@slave01 ~]$ ssh-keygen -t rsa
shell [zkpk@slave01 ~]$ mv authorized_keys ~/.ssh/