Hadoop用户的无密码信任关系实验

1、新建用户hadoop

useradd    hadoop

2、切换到hadoop用户

su - hadoop

3、先清空.sshwenj

rm -rf .ssh

4、生成秘钥

ssh-keygen

[hadoop@hadoop001 ~]$ cd .ssh/

[hadoop@hadoop001 .ssh]$ ll

total 8

-rw-------. 1 hadoop hadoop 1675 May 19 00:19 id_rsa

-rw-r--r--. 1 hadoop hadoop  400 May 19 00:19 id_rsa.pub

5、配置公钥至authorized_keys

[hadoop@hadoop001 .ssh]$ cat id_rsa.pub >> authorized_keys

6、配置权限(与root区别是必须配权限)

[hadoop@hadoop001 .ssh]$ chmod 600 authorized_keys

7、测试

[hadoop01@hadoop001 .ssh]$ ssh hadoop001 date

The authenticity of host 'hadoop001 (192.168.137.130)' can't be established.

RSA key fingerprint is e2:45:07:d4:92:00:f9:8b:f6:79:c3:8d:5f:20:96:c0.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'hadoop001,192.168.137.130' (RSA) to the list of known hosts.

Sat May 19 00:28:17 CST 2018

第一次需要确认

[hadoop01@hadoop001 .ssh]$ ssh hadoop001 date

Sat May 19 00:28:20 CST 2018

后面再输入该命令就无需确认

你可能感兴趣的:(Hadoop用户的无密码信任关系实验)