centos password-free login

Both hosts are CentOS systems, and the host names are node0 and node1 respectively. The IP of node0 is 10.141.4.36, and the IP of node1 is 10.141.4.39. Both hosts use the username cluster.

1. Perform the following operations on node0 and node1:

Add the following content to the /etc/hosts file:

10.141.4.36 node0
10.141.4.39 node1 Run

the following command in the /home/cluster directory to generate the .ssh directory:

ssh-keygen - t rsa

2. Execute the following command in the /home/cluster/.ssh directory of node1:

scp node0:/home/cluster/.ssh/id_rsa.pub /home/cluster/.ssh/tmp
cat tmp >> authorized_keys
rm tmp

3. Execute the following command in the /home/cluster/.ssh directory of node0:

scp node1:/home/cluster/.ssh/id_rsa.pub /home/cluster/.ssh/tmp
cat tmp >> authorized_keys
rm tmp

4. Check if node0 and node1 can log in to each other directly without password:

ssh node0
ssh node1

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326411243&siteId=291194637