We often encounter this situation, from a Linux Server SSH to another Linux server, or use SCP or rsync to transmit data from one Linux server to another. Each operation requires a password for verification. If we establish a trust relationship between servers, we do not need to enter the password every time.
The trust relationship is as follows:
(1) switch to the root directory of the user who needs to establish a trust relationship
(2) execute the command: SSH-keygen-d
The prompt "Enter file in which to save the key" is displayed.
You can press enter to select the default option.
Prompt enter passphrase (empty for no passphrase)
You can press enter to select the default option.
The prompt "Enter same passphrase again" is displayed:
You can press enter to select the default option.
The. Ssh directory appears under the root directory of the user. Two files are generated under the. Ssh Directory: Public Key id_dsa and private key id_dsa.pub.
(3) create the authorized_key file under the. Ssh directory
(4) execute 1 ~ Step 3
(5) Take server a and server B as an example to Establish a trust relationship between server a and server B. Write the content of the public key id_dsa.pub of server a to the authorized_key of server B so that B can access a. Write the content of the public key id_dsa.pub of server B to the authorized_key of server, so that a can access B. In this way, access between A and B establishes a trust relationship.
(6) establish the same trust relationship between multiple servers (5). You only need to append the content of the public key id_dsa.pub to the authorized_key file.