From:
Http://yangzhongfei.blog.163.com/blog/static/461098752010314105937739/
The two Linux systems directly copy files. If you log on to the graphical interface, it is relatively simple to create a samba shared copy.
However, it is more cost-effective to use SCP for Shell login.
You can use the SCP command to transfer files between two Linux Hosts. You do not need to enter a password after establishing a trust relationship.
Copy the SSH public key file of your local host user to the remote host user's ~ /. Ssh/authorized_keys File
Assume that the local host linux100 and remote host linux200
1. users in the linux100 host
Run
# Ssh-keygen-T RSA
The result is as follows:
Quote:
Generating public/private RSA key pair.
Enter file in which to save the key (/home/. Username/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/. Username/. Ssh/id_rsa.
Your public key has 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 username @ localhost
Generating RSA keys:
Key Generation complete.
Will be in the user directory ~ /. Ssh/generate two files: id_rsa, id_rsa.pub
2. Copy the id_rsa.pub file on the linux100 host to the. Ssh directory under the root user home directory of the linux200 host and change it to authorized_keys.
That is:
/Root/. Ssh/authorized_keys
In this way, on the linux100 host, use the SCP command to copy the file to linux200 without prompting you to enter the password.
And vice versa!
3. copy a file or directory command:
Copy a file:
(1) Copy local files to remote
SCP file name -- User Name @ computer ip address or computer name: remote path
(2) remotely copy the file back to local
SCP -- username @ computer ip address or computer name: local path of file name
Copy directory:
(1) copy the local directory to a remote
SCP-r directory name -- User Name @ computer ip address or computer name: remote path
(2) remotely copy the directory back to local
SCP-r -- User Name @ computer ip address or computer name: local directory name path