First, install the SSH service on the two computers that transmit files to each other:
1. Yum-y install openssh2 and Yum-y install OpenSSH-clients
1. Obtain files on the remote server
SCP-P 2222 root@www.vpser.net:/root/lnmp0.4.tar.gz/home/lnmp0.4.tar.gz
The upper-case p parameter indicates the port after the ssh port is changed. If the ssh port is not changed, you do not need to add this parameter. Root@www.vpser.net represents using the root user to log on to the remote server www.vpser.net,:/root/lnmp0.4.tar.gz represents the file on the remote server, and the last/home/lnmp0.4.tar.gz represents the path and file name saved locally.
2. Obtain the directory on the remote server
SCP-P 2222-r root@www.vpser.net:/root/lnmp0.4 // home/lnmp0.4/
The upper-case p parameter indicates the port after the ssh port is changed. If the ssh port is not changed, you do not need to add this parameter. The-R parameter indicates recursive replication (that is, copying the files and directories under the Directory); The root@www.vpser.net indicates using the root user to log on to the remote server www.vpser.net ,: /root/lnmp0.4/indicates the directory on the remote server, And/home/lnmp0.4/indicates the path saved locally.
3. upload local files to the server
SCP-P 2222/home/lnmp0.4.tar.gz root@www.vpser.net:/root/lnmp0.4.tar.gz
The upper-case p parameter indicates the port after the ssh port is changed. If the ssh port is not changed, you do not need to add this parameter. /Home/lnmp0.4.tar.gz indicates the path and file name of the local file to be uploaded. The root@www.vpser.net represents using the root user to log on to the remote server www.vpser.net, And:/root/lnmp0.4.tar.gz represents the Directory and file name saved on the remote server.
4. Upload the local directory to the server
SCP-P 2222-r/home/lnmp0.4/root@www.vpser.net:/root/lnmp0.4/
The upper-case p parameter indicates the port after the ssh port is changed. If the ssh port is not changed, you do not need to add this parameter. The-R parameter indicates recursive replication (that is, copying the files and directories under the Directory);/home/lnmp0.4/indicates the directory to be uploaded, The root@www.vpser.net indicates using the root user to log on to the remote server www.vpser.net, :/root/lnmp0.4/indicates the directory location stored on the remote server.
5. Several useful parameters:
-V is the same as-V in most Linux commands. It is used to display the progress. It can be used to view the connection, authentication, or configuration error.
-C enable compression options.
-4 Use the IPv4 address forcibly.
-6 Use IPv6 addresses forcibly.