The ssh automatic login needs to use public key and private key. Under Linux, use ssh-keygen to generate public/private key pairs, taking CentOS as an example.
There are Virtual Machines A(192.168.1.155) and Virtual Machines B(192.168.1.181). And set the user of Virtual Machines A to the user of Virtual Machines B through ssh automatic login.
If the root user sets the automatic login, replace the path /home/user in the following method with /root. When using scp to replicate, replace the target machine user with root.
[user@A ~]$ ssh-keygen -t rsa
When an interactive interface appears and it is required to enter password and key pair save path, etc., press Enter to generate by default. After the execution is successful, the .ssh directory is generated under /home/user. There are id_rsa and id_rsa.pub under .ssh.
[user@A ~]$ scp .ssh/id_rsa.pub email@example.com:/home/user/id_rsa.pub
firstname.lastname@example.org's password:'s password:
id_rsa.pub 100% 223 0.2KB/s 00:00
[user@B ~]$ cat /home/user/id_rsa.pub >> /home/user/.ssh/authorized_keys
[user@B ~]$ chmod 600 /home/user/.ssh/authorized_keys
Authority of authorized_keys is to be set to 600.
[user@A ~]$ ssh email@example.com
The authenticity of host 'B (192.168.1.181)' can't be established.
RSA key fingerprint is 00:a6:a8:87:eb:c7:40:10:39:cc:a0:eb:50:d9:6a:5b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.181' (RSA) to the list of known hosts.
Last login: Thu Mar 3 09:53:18 2018 from user
The first time you log in, you need to enter yes to add Virtual Machines B to the known machine list of Virtual Machines A
Now, the user of Virtual Machines A can automatically log in to the user of Virtual Machines B.
To realize mutual automatic login of Virtual Machines A and B, configure on Virtual Machines B by the above method and add id_rsa.pub content generated by Virtual Machines B to authorized_keys file of Virtual Machines A.