ssh免密登录

集群之间传递文件需要输入密码,不方便.可以配置SSH免登

生成秘钥

ssh-keygen -t rsa

查看生成的密钥

[root@localhost hadoop]# ll ~/.ssh
total 8
-rw-------. 1 root root 1675 Jan  6 22:04 id_rsa
-rw-r--r--. 1 root root  408 Jan  6 22:04 id_rsa.pub

写入文件

cat ~/.ssh >> authorized_keys

复制秘钥到另一台虚拟机的~/.ssh/authorized_keys文件中, 没有创建一个.

scp使用示例:

[root@localhost soft]scp a.test root@node02:/usr/soft
The authenticity of host 'node02 (192.168.37.130)' can't be established.
ECDSA key fingerprint is SHA256:5Qe7dlOrhDVyiGfGUEY5rWyAJJaPt+AKB9ZWq5uxglQ.
ECDSA key fingerprint is MD5:1a:11:77:81:e9:7f:3a:5c:d8:f2:4a:58:b1:55:29:9e.
# 第一次需要确认
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'hadoop02,192.168.37.130' (ECDSA) to the list of known hosts.
a.test                                               100%    0     0.0KB/s   00:00 
posted @ 2020-09-30 09:36  林宇风  阅读(138)  评论(0编辑  收藏  举报