Linux SSH remote file/folder transfer command SCP

Source: Internet
Author: User
Tags vps scp command secure copy what is scp

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, the files will be transferred directly to the Web server folder. Then run on the target machine: wget http://www.vpser.net/testfile.zip. The SCP command comes in handy when the Web server and FTP server are not 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 to remotely copy files under Linux, and a command similar to it has CP, except that the CP is only copied natively and cannot cross server, and the SCP transfer is encrypted. may have a slight impact on speed.

Ii. What is the use of SCP?

1. We need to obtain a file on the remote server. Remote server has neither configured ftpserver. Did not open webserver, nor did it share. When documents cannot be obtained by conventional means, the purpose can be easily achieved only through the SCP command.

2, we need to upload the files on the computer to the remote server, remote server does not open Ftpserver or share, can not be uploaded by conventional means. It is only through the SCP command that it is easy to achieve the goal.

Iii. SCP usage 1. Get files on remote server

Scp-p 2222 [Email protected]:/root/lnmp0.4.tar.gz/home/lnmp0.4.tar.gz

The upper port capital P is the parameter, and 2222 indicates the port after the Sshport change. Assuming that there is no change, sshport can not join the parameter. [email protected] means using the root user to log on to the remote serverwww.vpser.net. :/root/lnmp0.4.tar.gz represents a file on a remote server, and the last/home/lnmp0.4.tar.gz represents the path and file name saved locally.

2. Get the folder on the remote server

Scp-p 2222-r [Email protected]:/root/lnmp0.4//home/lnmp0.4/

Upper Port Upper case p is the number of parameters. 2222 indicates the port after the change of Sshport. Assuming that there is no change, sshport can not join the parameter. The-r reference indicates a recursive copy (that is, the files and folders below the folder are copied); [email protected] means that using the root user to log on to remote serverwww.vpser.net,:/root/lnmp0.4/represents a folder on a remote server. The/home/lnmp0.4/of the last face 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 Upper case p is the number of parameters. 2222 means to change the port after Sshport, assuming that there is no change sshport can not join the 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 using the root user to log on to the remote serverwww.vpser.net. :/root/lnmp0.4.tar.gz represents the folder and file name that is saved on the remote server.

4. Upload the local folder to the server

Scp-p 2222-r/home/lnmp0.4/[email protected]:/root/lnmp0.4/

The upper port capital P is the parameter, 2222 means that the port after Sshport is changed, assuming that there is no change sshport can not join the parameter. The-r parameter means recursive replication (that is, copying files and folders below the folder);/home/lnmp0.4/indicates the folder to be uploaded. [email protected] means using the root user to log on to the remote serverwww.vpser.net. :/root/lnmp0.4/represents the folder location that is saved on the remote server.

5, may be useful several of the parameters:

-V is the same as-V in most Linux commands to show the progress of the run. 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.

Linux SSH remote file/folder transfer command SCP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.