I. Prepare the environment
Host a: local server;
Host B: Remote Server (192.168.1.15 );
Both host a and host B are Linux servers;
Ii. Configuration
Operate on host:
CD
Mkdir. SSH
CD. SSH
Ssh-keygen-t rsa (Press enter three times in a row, that is, a public key and private key are generated in the keystore without a password)
# Ls
Id_rsa id_rsa.pub
The above two files will be generated;
Operate on host B:
CD
Mkdir. SSH
CD. SSH
Touch/root/. Ssh/authorized_keys2
Return to host a and perform the following operations:
SCP/root/. Ssh/id_rsa.pub [email protected]:/root/. Ssh/a_rsa.pub (enter the password of host B)
Return to host B and perform the following operations:
CAT/root/. Ssh/a_rsa.pub> authorized_keys2 (append the content of the public key of host a to authorized_keys2)
Iii. Verification
On host:
CD
Touch test. Log
SCP test. log [email protected]:/root/(transfer can be completed without a password)
This article from "square inch Hill" blog, please be sure to keep this source http://63638790.blog.51cto.com/513514/1548322
Ssh scp password-free method