1.原理图
2.操作
[atguigu@hadoop102 ~]$ pwd
/home/atguigu
ls -al 可以看到隐藏的文件信息
[atguigu@hadoop102 .ssh]$ pwd
/home/atguigu/.ssh
[atguigu@hadoop102 .ssh]$
[atguigu@hadoop102 .ssh]$ ll
总用量 4
-rw-r--r--. 1 atguigu atguigu 561 8月 21 21:58 known_hosts
[atguigu@hadoop102 .ssh]$
查看相关的文件信息
记录了相关的访问信息
去掉空格 Bad escape character 'ygen'.
[atguigu@hadoop102 .ssh]$ ssh -keygen -t rsa
Bad escape character 'ygen'.
[atguigu@hadoop102 .ssh]$
[atguigu@hadoop102 .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/atguigu/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/atguigu/.ssh/id_rsa.
Your public key has been saved in /home/atguigu/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:TJIV8MK9m3r62PLZhjywpqXmR9GM58INjXCmA53lhJ8 atguigu@hadoop102
The key's randomart image is:
+---[RSA 2048]----+
| . ++.o. |
| . =+o= |
| . **B+ |
| o E==. |
| o *S |
| = oo |
| ..=o. |
| .o=+=o. |
| o+++*=o. |
+----[SHA256]-----+
分别在102上 向103,104,102(自己) 配置
103
ssh-copy-id hadoop103
104
ssh-copy-id hadoop104
102 自己对自己
ssh-copy-id hadoop102
3.103上类似的操作
3.1
[atguigu@hadoop103 .ssh]$ pwd
/home/atguigu/.ssh
[atguigu@hadoop103 .ssh]$
ssh-keygen -t rsa
生成公钥
然后103上拷贝到102
ssh-copy-id hadoop102
然后103上拷贝到104
ssh-copy-id hadoop104
然后103上拷贝到103(自己对自己)
ssh-copy-id hadoop103
3.2 在 104上类似的操作
ssh-keygen -t rsa
生成公钥
然后104上拷贝到102
ssh-copy-id hadoop102
然后104上拷贝到103
ssh-copy-id hadoop103
在104上拷贝到104(自己对自己)
ssh-copy-id hadoop104
4.对于普通用户来说已经配置好了 atguigu/123456
但是对于root用户来说 还是要重新配置
ssh-keygen -t rsa
生成公钥
ssh-copy-id hadoop102
ssh-copy-id hadoop103
ssh-copy-id hadoop104
这边的密码 root
102 不知道为啥原因
[atguigu@hadoop102 ~]$ xsync
bash: xsync: 未找到命令...
相似命令是: 'sync'
没解决(待补充)
神奇重启集群就好了
103上测试一个文本文件 bb.txt