Requirements: Four Linux hosts, IP address 192.168.10.10/11/12/13, configure root user equivalence
1. Each node Ssh-keygen generates an RSA key and public key
?
| 1 |
ssh-keygen -q -t rsa -N "" -f ~/.ssh/id_rsa |
2. Summarize all public key files into a total authorized key file
Perform the rollup in 10:
?
| 1 2 3 4 |
ssh 192.168.10.10 cat ~/.ssh/id_rsa pub >> ~/.ssh/authorized_keys ssh 192.168.10.11 cat ~/.ssh/id_rsa pub >> ~/.ssh/authorized_keys ssh 192.168.10.12 cat ~/.ssh/id_rsa pub >> ~/.ssh/authorized_keys ssh 192.168.10.13 cat ~/.ssh/id_rsa pub >> ~/.ssh/authorized_keys |
For security reasons, assign this authorization key file 600 permissions:
?
| 1 |
chmod 600~/.ssh/authorized_keys |
3. Distribute this authentication file, which contains all trusted machine authentication keys, to each machine
?
| 1 2 3 |
scp ~/.ssh/authorized_keys 192.168.10.11:~/.ssh/ scp ~/.ssh/authorized_keys 192.168.10.12:~/.ssh/scp ~/.ssh/authorized_keys 192.168.10.13:~/.ssh/ |
4. Verify mutual trust, each node executes the following command, can not enter the password display time, configuration success
?
| 1 |
ssh 192.168.10.10 date;ssh 192.168.10.11 date;ssh 192.168.10.12 date;ssh 192.168.10.13date; |
5. Configure trust, borrow a practical small script written by colleagues, built on 10, in order to quickly synchronize the unified configuration file between the cluster
?
| 1 2 3 4 5 6 7 8 |
vi bulkcp.sh #!/bin/bash for((i=11;i<=13;i++)) do scp -r $1 192.168.10.$i:$2 echo scp -r $1 192.168.10.$i:$2 done ./bulkcp.sh /etc/hosts /etc/hosts |