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 scp to copy between multiple linux systems

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

Share

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

Editor to share with you how to use scp in multiple linux systems for copy, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

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.

The above is all the contents of the article "how to use scp to copy between multiple linux systems". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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