Linux uses SSH remote file Transfer command Scp__linux

Source: Internet
Author: User
Tags scp command secure copy

Under Linux generally use the SCP command to transfer files via SSH.
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, download files from the server
SCP username@servername:/path/filename/var/www/local_dir (local directory)

For example, the SCP root@192.168.0.101:/var/www/test.txt downloads/var/www/test.txt files on 192.168.0.101 to/var/www/local_dir (local directory)

2, upload local files to the server
Scp/path/filename Username@servername:/path

For example, scp/var/www/test.php root@192.168.0.101:/var/www/upload test.php files from the native/var/www/directory to 192.168.0.101 on this server In the Directory

3, download the entire directory from the server
Scp-r username@servername:/var/www/remote_dir/(remote directory)/var/www/local_dir (local directory)

For example: Scp-r root@192.168.0.101:/var/www/test/var/www/

4, upload directory to the server
Scp-r Local_dir Username@servername:remote_dir
For example: Scp-r test root@192.168.0.101:/var/www/uploads the test directory in the current directory to the server's/var/www/directory

Note: The target server will open write permission.

From:http://www.cnblogs.com/jiangyao/archive/2011/01/26/1945570.html

Http://linux.cn/article-31-1.html

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.