[Original] Linux server cluster logon via SSH without a password, server cluster ssh
SSH Without Password authorized access to server Load balancer cluster machines 1. Install SSH. SSH must be installed on all cluster machines.
Environment: Master: CNT06BIG01 192.168.3.61SLAVE 1: CNT06BIG02 192.168.3.62SLAVE 2: CNT06BIG03 192.168.3.63 # yum install ssh
2. Create the key and public key on master/slave 1/slave 2 machines respectively, and execute the following command to create the key # ssh-keygen-t dsa-p'-f ~ /. Create a public key using ssh/id_dsa and import the public key to authorized_keys # cat ~ /. Ssh/id_dsa.pub> ~ /. Ssh/authorized_keys: Set the local machine to log on without a password. After executing the command, select yes # ssh localhost or ssh machine name or ssh machine IP address.
3. On the master machine (CNT06BIG01), run the command to distribute the public key to Server Load balancer 1/2 machine 3.1 and distribute it to Server Load balancer 1: CNT06BIG02 on the master machine (CNT06BIG01 ~ /. Ssh directory, run the following command # scp authorized_keys root @ CNT06BIG02 :~ /. Ssh/authorized_keys_from_master, and then go to ~ /. Ssh directory, execute the following command # cat authorized_keys_from_master> authorized_keys. Then, you can log on to the Server Load balancer 01 (CNT06BIG02) without a password on the Mater machine (CNT06BIG02) #
Note: If you want SLAVE 01 (CNT06BIG02) to log on to the master without a password (CNT06BIG01) at the same time, you only need to perform the following steps on Server Load balancer 01 (CNT06BIG02) to go ~ /. Ssh directory, run the following command # scp authorized_keys root @ CNT06BIG01 :~ /. Ssh/authorized_keys_from_master and then on the master machine (CNT06BIG01), enter ~ /. Ssh directory, execute the following command # cat authorized_keys_from_master> authorized_keys. Finally, you can log on to the master machine (CNT06BIG02) without a password (CNT06BIG01) on Server Load balancer. # The effect is
3.2 distribute to SLAVE 2: CNT06BIG03 on the master machine (CNT06BIG01 ~ /. Ssh directory, run the following command # scp authorized_keys root @ CNT06BIG03 :~ /. Ssh/authorized_keys_from_master and go to ~ /. Run the following command in the ssh directory # cat authorized_keys_from_master> authorized_keys. Then, log on to the Server Load balancer 02 (CNT06BIG03) without a password on the Mater machine (CNT06BIG03) # ssh CNT06BIG03: if you want to allow SLAVE 02 (CNT06BIG03) to log on to the master without a password (CNT06BIG01) at the same time, you only need to perform the following steps on the server Load balancer 02 (CNT06BIG03) and enter ~ /. Ssh directory, run the following command # scp authorized_keys root @ CNT06BIG01 :~ /. Ssh/authorized_keys_from_master and then on the master machine (CNT06BIG01), enter ~ /. Run the following command in the ssh directory # cat authorized_keys_from_master> authorized_keys. Then, log on to the master machine (CNT06BIG03) on Server Load balancer 02 (CNT06BIG01) without a password) # The effect of ssh CNT06BIG01 is as follows: 3.3 If you enable the Server Load balancer 01 (CNT06BIG02) and Server Load balancer 02 (CNT06BIG03) to log on without a password, the operation steps are as follows: 3.1 or 3.2. On SLAVE 01 (CNT06BIG02), enter ~ /. Ssh directory, run the following command # scp authorized_keys root @ CNT06BIG03 :~ /. Ssh/authorized_keys_from_master and go to ~ /. In the ssh directory, run the following command # cat authorized_keys_from_master> authorized_keys. Then, log on to the Server Load balancer 01 (CNT06BIG02) without a password (CNT06BIG03) # ssh CNT06BIG03 effect: if you want SLAVE 02 (CNT06BIG03) to log on to SLAVE 01 (CNT06BIG02) without a password, perform the following steps on Server Load balancer 02 (CNT06BIG03) and go ~ /. Ssh directory, run the following command # scp authorized_keys root @ CNT06BIG02 :~ /. Ssh/authorized_keys_from_master and then on SLAVE 01 (CNT06BIG02), enter ~ /. Run the following command in the ssh directory # cat authorized_keys_from_master> authorized_keys. Then, log on to the master machine (CNT06BIG03) on Server Load balancer 02 (CNT06BIG01) without a password) # The effect of ssh CNT06BIG02 is as follows: [end] If you want to log out of ssh remote login, you only need to enter the command exit. [Conclusion] As shown in the above method, we know that Linux Server clusters can be configured with ssh logon without a password: You need to install an ssh certificate and copy the Public Key between n machines. The number of times this public key is copied is (n) (n-1) times. Obviously, it is a lot of physical work, and it is urgent to find a simpler method or solution.
[Original]You are welcome to exchange and share the technology. For more information, please attach the following content:
If you think this article is helpful to you, please remember to give me a thumbs up. Thank you!By kevin 【