You can use the SCP command when you want to transfer files between two Linux hosts, and you cannot enter a password after you establish a trust relationship. Copy your local host user's SSH public key file to the remote host user's ~/.ssh/authorized_keys file assume that the local host linux100, the remote host linux200 one, the user in the LINUX100 host Run #ssh-keygen-t RSA results as follows quote: generating public/private RSA key Pair. enter file in which to save T He key (/home/.username/ssh/id_rsa): #回车 enter Passphrase (empty for no passphrase): #回车 enter same passphrase Again: #回车 your identification have been saved In/home/.username/.ssh/id_rsa. your public key have been saved in /home/.username/.ssh/id_rsa.pub. the Key Fingerprint is: 38:25:c1:4d:5d:d3:89:bb:46:67:bf:52:af:c3 : 17:0c [email protected] generating RSA Keys: key generation complete. Will generate two files in the user directory ~/.ssh/, id_ rsa,id_rsa.pub Two, copy the Id_rsa.pub file on the linux100 host to the. SSH directory under the root user directory of the linux200 host, and change the name to authorized_keys : /root/.ssh/authorized_keys the use of the SCP command on the linux100 host to copy files to linux200 will not prompt for a password, directly copied. You can also use the SCP command on the LINUX100 host to copy the files on the linux200 to the local computer, and without verification, you can access the linux100 LinuX200 and vice versa! Note: If more than one computer needs to replicate with linux200, simply copy the contents of the id_rsa.pub to the Authorized_keys file. Perform cat ~/.ssh/a.pub >> ~/.ssh/authorized_keys Add content to three, copy file or directory commands: copy files: (1) Copy Local files to remote  SCP filename User name @ computer IP or computer name: remote path (2) Copying files from remote to local  SCP user name @ computer IP or computer name: file name Local path Copy directory: (1) Copy the local directory to the remote  SCP-R directory name-user name @ computer IP or computer name: remote path (2) Remotely copy directory back to local  SCP-R username @ computer IP or computer name: Directory name Local Path
How SCP commands transfer files between Linux