scp between linux servers does not enter password

1. Run the ssh-keygen command on the machine Client as the root user to generate a certificate for establishing a security trust relationship.
   [root@Client root]# ssh-keygen -b 1024 -t rsa
    all the way to enter
   [root@Client root]#
2. Copy the public key certificate id_rsa.pub to the .ssh subdirectory of the root home directory of the machine Server, Also replace the file name with authorized_keys.
   [root@Client root]# scp -p ./id_rsa.pub [email protected]:/devop/.ssh/authorized_keys
   [email protected]'s password: <-- Enter the devop user password of the machine Server

Note :
1 The permissions of the .[.ssh] folder must be 755.
2. When executing the [copy command for the first time], the root user of the two machines has not yet established a security trust relationship, so [the root user password of the machine server needs to be entered]. After the above steps, a secure trust relationship is established between the root of the machine Client and the root of the machine Server. When [execute the copy again], there is no need to enter a password.

3. If you give [A's public key to B], then you can transfer data to B without entering a password on SCP on A]; but [Password is still required when SCP is on B], if both parties do not need to enter a password , then also give B's public key to A.
4. If you want B and C to transmit the data in A through SCP without entering the password at the same time; you must give both the public keys of B and C to A. Copy the data in the id_rsa.pub of the two machines B and C to the /root/.ssh/authorized_keys file of A, one line represents one.

5. If the [authorized_keys file already exists, append it]: cat ~/id_rsa.pub >> ~/.ssh/authorized_keys.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326819700&siteId=291194637