#三台机器互相免密登录
#1、三台机器执行以下命令
[root@cdh1 ~]# ssh-keygen -t rsa
[root@cdh2 ~]# ssh-keygen -t rsa
[root@cdh3 ~]# ssh-keygen -t rsa
#2、进入/.ssh/目录 该目录存放密钥对
[root@cdh1 ~]# cd ~/.ssh/
#3、新建authorized_keys并设置权限
[root@cdh1 .ssh]# touch authorized_keys
[root@cdh1 .ssh]# chmod 600 authorized_keys
#4、公钥追加 authorized_keys
[root@cdh1 .ssh]# cat id_rsa.pub >> authorized_keys
#5、另外两台机器也执行如下操作
#cdh2
[root@cdh2 ~]# cd ~/.ssh/
[root@cdh2 .ssh]# touch authorized_keys
[root@cdh2 .ssh]# chmod 600 authorized_keys
[root@cdh2 .ssh]# cat id_rsa.pub >> authorized_keys
#cdh3
[root@cdh3 ~]# cd ~/.ssh/
[root@cdh3 .ssh]# touch authorized_keys
[root@cdh3 .ssh]# chmod 600 authorized_keys
[root@cdh3 .ssh]# cat id_rsa.pub >> authorized_keys
#6、把cdh2的公钥追加到cdh1的authorized_keys
[root@cdh2 .ssh]# scp id_rsa.pub cdh1:/home/
[root@cdh1 .ssh]# cat ../../home/id_rsa.pub >> ./authorized_keys
#7、把cdh1的公钥追加到cdh2的authorized_keys
[root@cdh1 .ssh]# scp id_rsa.pub cdh2:/home/
[root@cdh2 .ssh]# cat ../../home/id_rsa.pub >> ./authorized_keys
#8、把cdh1的公钥追加到cdh3的authorized_keys
[root@cdh1 .ssh]# scp id_rsa.pub cdh3:/home/
[root@cdh3 .ssh]# cat ../../home/id_rsa.pub >> ./authorized_keys
#9、把cdh2的公钥追加到cdh3的authorized_keys
[root@cdh2 .ssh]# scp id_rsa.pub cdh3:/home/
[root@cdh3 .ssh]# cat ../../home/id_rsa.pub >> ./authorized_keys
#10、把cdh3的公钥追加到cdh1的authorized_keys
[root@cdh3 .ssh]# scp id_rsa.pub cdh1:/home/
[root@cdh1 .ssh]# cat ../../home/id_rsa.pub >> ./authorized_keys
#10、把cdh3的公钥追加到cdh2的authorized_keys
[root@cdh3 .ssh]# scp id_rsa.pub cdh1:/home/
[root@cdh2 .ssh]# cat ../../home/id_rsa.pub >> ./authorized_keys
#此时cdh1、cdh2、cdh3互相免密