Updated on 2023-05-29 GMT+08:00

Configuring the Mutual Trust Relationship

Ensure that two severs can communicate with each other using SSH. Assume that the two servers for synchronization are node 1 and node 2. Perform the following steps to configure the mutual trust relationship.

Procedure

  1. Log in to node 1 as user root.
  2. Generate the public and private keys.

    ssh-keygen -t rsa

    The following information is displayed:

    Generating public/private rsa key pair. Enter file in which to save the key (/home/deven/.ssh/id_rsa): (Press Enter.)
    Enter passphrase (empty for no passphrase): (Press Enter.)
    Enter same passphrase again: (Press Enter.)
    Your identification has been saved in /home/deven/.ssh/id_rsa.
    Your public key has been saved in /home/deven/.ssh/id_rsa.pub.
    The key fingerprint is:89:56:d6:4a:b2:6c:4a:05:............

    Press Enter after you enter the information required each time as prompted. The id_rsa and id_rsa.pub files are generated in the /root/.ssh/ directory.

  3. Write id_rsa.pub to the authorized-keys file.

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

  4. Modify the permission of id_rsa.

    chmod 600 /root/.ssh/id_rsa

  5. Copy anthorized-keys and id_rsa to node 2.

    scp /root/.ssh/authorized_keys IP address of node 2:/root/.ssh/

    After the command is executed, a message is displayed, indicating whether to connect to the node. Enter yes and then enter the password of node 2. The files are copied to node 2.

    scp /root/.ssh/id_rsaIP address of node 2:/root/.ssh/

  6. Check whether the two servers can communicate with each other using using SSH.