I believe you vpser in the use of VPS will often in different VPS between the backup data or transfer data, most of the time the VPS has installed Nginx or similar Web server, directly to transfer the files to the Web server directory, Then execute on the target machine: wget http://www.vpser.net/testfile.zip on the line. The SCP command comes in handy when there is no Web server and FTP server installed on the VPS or if the method is more cumbersome.
First, what is SCP?
The SCP is a shorthand for secure copy, a command for remotely copying files under Linux, and a similar command with CP, although the CP is only copied natively and cannot cross the server, and the SCP transfer is encrypted. may have a slight effect on the speed.
Ii. What is the use of SCP?
1, we need to obtain a file on the remote server, the remote server does not configure the FTP server, does not open the Web server, and does not share, unable to obtain the file through the regular way, only through the SCP command can easily achieve the purpose.
2, we need to upload the file on the computer to the remote server, the remote server does not open the FTP server or share, can not be uploaded through the conventional way is, only through the SCP command to easily achieve the purpose.
Iii. SCP Use Method 1, obtaining files on a remote server
Scp-p 2222 [Email protected]:/root/lnmp0.4.tar.gz/home/lnmp0.4.tar.gz
Upper Port Capital P is the parameter, 2222 means the port after changing the SSH port, if not changed SSH port can not add this parameter. [email protected] means that 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 face/home/ Lnmp0.4.tar.gz represents the path and file name that is saved locally.
2. Get the directory on the remote server
Scp-p 2222-r [Email protected]:/root/lnmp0.4//home/lnmp0.4/
Upper Port Capital P is the parameter, 2222 means the port after changing the SSH port, if not changed SSH port can not add this parameter. The-r parameter indicates a recursive copy (that is, the files and directories under the directory are copied); [email protected] means to log on to the remote server using the root user www.vpser.net,:/root/lnmp0.4/represents the directory on the remote server, the last The/lnmp0.4/represents the path that is saved locally.
3. Upload the local file to the server
scp-p 2222/home/lnmp0.4.tar.gz [Email protected]:/root/lnmp0.4.tar.gz
Upper Port Capital P is the parameter, 2222 means the port after changing the SSH port, if not changed SSH port can not add this parameter. /home/lnmp0.4.tar.gz represents the path and file name of the file that is ready to be uploaded locally. [email protected] means that using the root user to log on to the remote server www.vpser.net,:/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/ [Email protected]:/root/lnmp0.4/
Upper Port Capital P is the parameter, 2222 means the port after changing the SSH port, if not changed SSH port can not add this parameter. The-r parameter indicates a recursive copy (that is, copying files and directories under the directory);/home/lnmp0.4/indicates the directory to be uploaded, [email protected] means to log on to the remote server using the root user www.vpser.net,:/root/ LNMP0.4/represents the directory location that is saved on the remote server.
5. Several parameters that may be useful:
-V is the same as-V in most Linux commands to show progress. Can be used to view connections, certifications, or configuration errors.
-C Enable compression option.
-4 forcibly use the IPV4 address.
-6 forcibly use the IPV6 address.
The file on the diahosting VPS is attached to the SCP transfer on Linode, at a speed of 10mb/s:
Linux SSH remote file/directory Transfer command SCP