Using SCP to get files on a remote Linux server Linux remote copy files _linux Shell

Source: Internet
Author: User
Tags ssh scp command secure copy ssh port

First, what is the SCP?

The SCP is a secure copy shorthand for remote copy of files under Linux, and a similar command has CP, but the CP is only copied on the local computer, not across servers, and the SCP transmission is encrypted. may have a slight impact on speed.

Second, what is the use of SCP?

1, we need to get a file on the remote server, the remote server has neither configured the FTP server, did not open the Web server, did not do the sharing, can not get the file through the regular way, only need to pass the SCP command can easily achieve the goal.

2, we need to upload the files on this machine to the remote server, the remote server does not open the FTP server or share, can not be uploaded through the normal way is, only need to pass the SCP command can be easily achieved.

Iii. methods of using SCP

1, get the files on the remote server

Copy Code code as follows:

Scp-p 2222 root@www.vpser.net:/root/lnmp0.4.tar.gz/home/lnmp0.4.tar.gz

The upper port caps p is the parameter, 2222 indicates that the port after the SSH port is changed, and if the SSH port is not changed, you do not need to add the parameter. Root@www.vpser.net indicates that using root to log on to a remote server www.vpser.net,:/root/lnmp0.4.tar.gz represents a file on a remote server, the last face of/home/ Lnmp0.4.tar.gz represents the path and file name that is saved locally.

2, get the directory on the remote server

Copy Code code as follows:

Scp-p 2222-r root@www.vpser.net:/root/lnmp0.4//home/lnmp0.4/

The upper port caps p is the parameter, 2222 indicates that the port after the SSH port is changed, and if the SSH port is not changed, you do not need to add the parameter. The-r parameter represents a recursive replication (that is, copying the files and directories under the directory); root@www.vpser.net indicates that using root to log on to the remote server www.vpser.net,:/root/lnmp0.4/represents the directory on the remote server, the last side of the HOME/LNMP0.4/represents the path that is saved locally.

3, upload the local files to the server

Copy Code code as follows:

Scp-p 2222/home/lnmp0.4.tar.gz root@www.vpser.net:/root/lnmp0.4.tar.gz

The upper port caps p is the parameter, 2222 indicates that the port after the SSH port is changed, and if the SSH port is not changed, you do not need to add the parameter. /home/lnmp0.4.tar.gz represents the path and file name of the file to be uploaded locally. Root@www.vpser.net indicates 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

Copy Code code as follows:

Scp-p 2222-r/home/lnmp0.4/root@www.vpser.net:/root/lnmp0.4/

The upper port caps p is the parameter, 2222 indicates that the port after the SSH port is changed, and if the SSH port is not changed, you do not need to add the parameter. The-r parameter represents a recursive replication (that is, copying the files and directories under the directory);/home/lnmp0.4/represents the directory to be uploaded, root@www.vpser.net means to log on to the remote server using root www.vpser.net,:/root/ LNMP0.4/represents the directory location that is saved on the remote server.

5, a number of possible useful parameters:

-V is the same as the-V meaning in most Linux commands, and is used to show progress. Can be used to view connections, authentication, or configuration errors.

-C enables compression options.

-4 forcibly use IPV4 address.

-6 forcibly use IPV6 address.

Related Article

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.