Establish SSH mutual trust between the same user on host a, host B, and host C:
1. Generate a key pair on host a user hcwang (e.g.
$ Ssh-keygen-T RSA
2. Go to the. Ssh directory.
$ MV id_rsa.pub authorized_keys // (change to the default public key file name)
3. Transmit the Public Key id_rsa.pub to the target host B, c
$ SCP id_rsa.pub B: $ home/. SSH
$ Cat id_rsa.pub> authorized_keys // if no authorized_keys exists, run the MV id_rsa.pub authorized_keys command.
Similarly, for host C
$ SCP id_rsa.pub C: $ home/. SSH
$ Cat id_rsa.pub> authorized_keys
At this point, you can directly SSH from host a to host B and C without a password. If you want to SSH from host B or C, SSH to host a, or between host BC, you need a password. The solution is as follows:
4. Copy the private key and id_rsa of host a to the $ home/. Ssh directory of host B and C.
$ SCP id_rsa B: $ home/. SSH
$ SCP id_rsa C: $ home/. SSH
~ OK