無
無
Linux集群規(guī)模20臺,需相互間免密登陸。
先選擇一臺主機保存所有主機的密鑰,然后將密鑰復(fù)制到所有主機。
1.登陸每臺主機創(chuàng)建ssh.pub:
[root@master-1 ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
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:Z0rzrrX1DA+Yjw6S9iFnoGQfQc9NVn1PXEXHohC/gno root@jumpserver
The key's randomart image is:
+---[RSA 3072]----+
| . +o.. +B|
| . o +.. o *|
| . o .... +.|
| . . .. .|
| o o S + . |
| o o * * + |
| . B E = + |
| . B = = * |
| oo= . + |
+----[SHA256]-----+
2. 每臺主機執(zhí)行ssh-copy-id root@master-1復(fù)制到Master-1
3.登陸Master-1將密碼復(fù)制到所有主機:
scp .ssh/authorized_keys root@master-2:/root/ssh.txt
scp .ssh/authorized_keys root@master-3:/root/ssh.txt
scp .ssh/authorized_keys root@node-1:/root/ssh.txt
....
4.登陸每臺主機,將ssh.txt追加到.ssh/authorized_keys即可。
cat /root/ssh.txt >> /root/.ssh/authorized_keys
無