密钥ssh 配置操作

一, 操作步骤
客户端进入一个用户hadoop     开启另一台机器,创一个用户hadoop 用于测试
(红字为输入代码)
[hadoop@localhost ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/hadoop/.ssh/id_rsa):
Created directory '/home/hadoop/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/hadoop/.ssh/id_rsa.
Your public key has been saved in /home/hadoop/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:u2aFFAWxwYXKuuY7qjsdp2Cm0bLV2GfMaTABT/N64Ys hadoop@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|  ..o  .+*o      |
|   o.o  +o       |
|    .oo...       |
|    ooo..        |
| . +.*ooS.       |
|+o= =oB....      |
|+B +E=. ..       |
|+ o +   o.       |
|o+.+oo o.        |
+----[SHA256]-----+
[hadoop@localhost ~]$ ls .ssh/
id_rsa  id_rsa.pub
[hadoop@localhost ~]$ ssh-copy-id -i /home/hadoop/.
./             .bash_logout   .cache/        .ssh/
../            .bash_profile  .config/       .viminfo
.bash_history  .bashrc        .mozilla/
    
[hadoop@localhost ~]$ ssh-copy-id -i /home/hadoop/.ssh/id_rsa.pub hadoop@192.168.100.68
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/hadoop/.ssh/id_rsa.pub"
The authenticity of host '192.168.100.68 (192.168.100.68)' can't be established.
ECDSA key fingerprint is SHA256:ic5T7l1Mcl2LKGLqF7aN/bAO0Jesw2biXeFOUbZBaoQ.
ECDSA key fingerprint is MD5:6d:23:55:7a:e8:8d:0e:04:3d:8c:89:bf:b9:ab:a7:6a.
Are you sure you want to continue connecting (yes/no)? yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
hadoop@192.168.100.68's password:
Number of key(s) added: 1
Now try logging into the machine, with:   "ssh 'hadoop@192.168.100.68'"
and check to make sure that only the key(s) you wanted were added.
测试:
[hadoop@localhost ~]$ ssh hadoop@192.168.100.68
Last login: Fri Aug 16 09:40:03 2019
[hadoop@localhost ~]$
原文地址:https://www.cnblogs.com/123456likun/p/11362645.html