Password-free login (add mutual trust to the machine)

1. Modify the name of the host

hostnamectl set-hostname 主机名

2. Add the address and host name of each host

vi /etc/hosts

Insert picture description here

3. Generate secret key

ssh-keygen -t rsa -P " "

4. Save the secret key by yourself

cat ~/.ssh/id_rsa.pub > .ssh/authorized_keys

5. Transmit the secret key to other machines

ssh-copy-id -i  ~/.ssh/id_rsa.pub root@机器名

6. Test whether the connection is successful

ssh 主机名

7. Demo

Insert picture description here

Guess you like

Origin blog.csdn.net/nayomi927/article/details/115282208