Linux-主机之间创建免密

一、四台主机进行免密

192.168.10.6
192.168.10.11
192.168.10.12
192.168.10.13

二、192.168.10.6主机生成密钥对,并将公钥传输到其它所有主机。

root@k8s-master01:~# ssh-keygen -t rsa -P ''
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:BkqF1ysQP9COkjGM3LEDoYP+akQaK8Zuef7VcmTnOR0 root@k8s-master01
The key's randomart image is:
+---[RSA 3072]----+
|.=o.++..         |
|+.=.++o .        |
|+  *.=+  .       |
|ooo.o.oo.        |
|++ ..  .So . E   |
|++.    .+ o o .  |
|= ..   o o + .   |
| =..  . o   .    |
|o.o...           |
+----[SHA256]-----+

root@k8s-master01:~# ssh-copy-id -i .ssh/id_rsa.pub root@192.168.10.6
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
The authenticity of host '192.168.10.6 (192.168.10.6)' can't be established.
ED25519 key fingerprint is SHA256:rP2GqlXjoG0UGi/kNixh1qXFg1dd1zJHIz2LutbTn80.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.10.6's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.10.6'"
and check to make sure that only the key(s) you wanted were added.

root@k8s-master01:~# ssh-copy-id -i .ssh/id_rsa.pub root@192.168.10.11
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
The authenticity of host '192.168.10.11 (192.168.10.11)' can't be established.
ED25519 key fingerprint is SHA256:sm5LyiMTU6zs8worQAgtjgx+rQPR/nXQIoBB+ETGPGU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.10.11's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.10.11'"
and check to make sure that only the key(s) you wanted were added.

root@k8s-master01:~# ssh-copy-id -i .ssh/id_rsa.pub root@192.168.10.13
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: ".ssh/id_rsa.pub"
The authenticity of host '192.168.10.13 (192.168.10.13)' can't be established.
ED25519 key fingerprint is SHA256:qibMIGG51Rj4vpV+yEsw0swurRYhrYWWZOWIBPQmC3g.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
root@192.168.10.13's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'root@192.168.10.13'"
and check to make sure that only the key(s) you wanted were added.
posted @ 2024-01-18 21:12  *一炁化三清*  阅读(49)  评论(0编辑  收藏  举报