Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the scp command to copy files between multiple Linux systems

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to use the scp command to copy files between multiple Linux systems, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

First, what is scp?

Scp is a secure remote file copy command based on ssh login in linux system. The scp command can copy files and directories between linux servers. SCP transfers data using the ssh security protocol and has the same authentication mechanism as ssh to securely copy files remotely.

When uploading and downloading files or directories from a linux system, ftp is the most used. If you use ftp, you need to log in and change the directory after login. In get and put, it is troublesome, and it is slow to use ftp, especially ftp with a graphical interface (for example: gftp). Of course, we can use rsync, we must maintain the directory between the two servers, ah, the files should be the same, the scope of application will be limited, there are many ways. Scp is relatively convenient and fast.

Second, scp parameters and description

[root@tank test] # scp-- helpusage: scp [- 1246BCpqrv] [- c cipher] [- F ssh_config] [- I identity_file] [- l limit] [- o ssh_option] [- P port] [- S program] [[user@] host1:] file1 [...] [[user@] host2:] file2-1 Force the scp command to use the protocol ssh2-2 to force the scp command to use the protocol ssh3-4 to force the scp command to use only IPv4 addressing-6 to force the scp command to use only IPv6 addressing-B uses batch mode (no transmission password or phrase is asked during transmission)-C allows compression. (pass the-C flag to ssh to turn on the compression feature)-p retains the modification time, access time, and access rights of the original file. -Q does not display the transmission progress bar. -r copy the entire directory recursively. -v displays the output in detail. Scp and ssh (1) show debugging information for the entire process. This information is used to debug connections, verify, and configure problems. -c cipher encrypts the data transfer in cipher, and this option is passed directly to ssh. -F ssh_config specifies an alternative ssh configuration file, which is passed directly to ssh. -I identity_file reads the key file used for the transfer from the specified file, and this parameter is passed directly to ssh. -l limit limits the bandwidth that users can use, in Kbit/s. -o ssh_option if you are accustomed to using the parameter passing method in ssh_config (5),-P port note that the uppercase P, port is the port number used to specify the data transfer-S program specifies the program used for encrypted transmission. This program must be able to understand the options of ssh (1).

Third, scp instance

1. Download the directory

[root@test test] # scp-r root@172.30.4.42:/tmp/test2. /

Copy the / tmp/test2 directory in the 172.30.4.42linux system to the current directory, and add the root@, prompt for the password before the 172.30.4.42. If you don't add it, you will be prompted to enter the user name and password.

2, download the file

[root@test test] # scp 172.30.4.42:/tmp/test2/aaa.php. /

Copy the / tmp/test2/aaa.php file in the 172.30.4.42linux system to the current directory

3. Upload the directory

[root@test test] # scp-r. / mytest 172.30.4.42:/tmp/test2

Upload the mytest directory from the current directory to the 172.30.4.42 server / tmp/test2 directory.

4. Upload files

[root@test test] # scp. / mytest/password.php 172.30.4.42:/tmp/test2

Upload the password.php under the mytest directory in the current directory to the 172.30.4.42 server / tmp/test2 directory.

This is the answer to the question about how to use the scp command to copy files between multiple Linux systems. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report