(This is the case for root user)
First, 3 machines, we take two workers, a boss for example
192.168.1.1 boss
192.168.1.2 Worker1
192.168.1.3 Worker2
1, Vim/etc/sysconfig/network
Modified hostname to BOSS,WORKER1 on 3 machines respectively, Worker2
2.vim/etc/hosts set the following configuration in 3 machines respectively.
192.168.1.1 boss
192.168.1.2 Worker1
192.168.1.3 Worker2
3. Execute ssh-keygent-t RSA generate encryption Key
Cd/root/.ssh and view LS
The public key id_rsa.pub is now generated
4. Cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
(Ps:authorized_keys is used to save the public key content of all users who are allowed to log on to the ssh client as the current user)
Verify that a single machine can log on using SSH
SSH localhost
The first time will prompt
Performed separately on the worker
SCP id_rsa.pub [Email protected]:/root/.ssh/id_pub.pub.worker1
SCP id_rsa.pub [Email protected]:/root/.ssh/id_pub.pub.worker2
Then execute on the Boss node
Cat ~/.ssh/id_rsa.pub.worker1 >> ~/.ssh/authorized_keys
Cat ~/.ssh/id_rsa.pub.worker2 >> ~/.ssh/authorized_keys
Then the Authorized_keys SCP of the Boss node to each node
SSH worker 1 is executed at this time
There will be a login, and you are already logged into the target machine
This enables the non-cipher communication of each machine.
Linux SSH multiple machines without password communication