这个问题如果理解不深入的话很容易答错,正确答案应该为:将A机器的id_rsa.pub(公钥)输出到B机器的authorized_keys中。
操作步骤:(假设hadoop000为A hadoop001为B)
1.两台机器执行
[root@hadoop000 ~]# rm -rf ~/.ssh [root@hadoop000 ~]# ssh-keygen [root@hadoop000 ~]# cd .ssh [root@hadoop000 .ssh]# cat id_rsa.pub >> authorized_keys [root@hadoop001 ~]# rm -rf ~/.ssh [root@hadoop001 ~]# ssh-keygen [root@hadoop001 ~]# cd .ssh [root@hadoop001 .ssh]# cat id_rsa.pub >> authorized_keys 生成公钥 并将公钥放入本机authorized_keys中
2.A机器的id_rsa.pub拷贝到B机器并输出到authorized_keys中
[root@hadoop000 .ssh]# scp id_rsa.pub 192.168.137.251:/root/.ssh/id_rsa.pub.hadoop000 [root@hadoop001 .ssh]# cat id_rsa.pub.hadoop000 >> authorized_keys