6.hadoop3 配置免密登录

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

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值