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 on the command line

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article will explain in detail how to use the scp command on the command line. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.

Scp, whose full name is secure copy, can encrypt files and transfer them between servers or between different users of the same server. Scp uses the same port 22 as ssh to communicate by default, and some servers change this port number to prevent attacks.

Command format

Scp [parameters] [original path] [destination path]

Specific examples

1. To copy from the local server to the remote server, the following command copies t1.fasta locally to the zbl user's home home directory of 202.202.202.202.

$scp t1.fasta zbl@202.202.202.202:~/

two。 You can also copy the entire folder to the remote server and add the-r parameter. The following command indicates that the t2_dir folder and all the files in it have been copied

$scp-r t2_dir zbl@202.202.202.202:~/

3. Similarly, you can be responsible from the remote server to the local server. You just need to change the order. The following command copies the t2_dir folder under the zbl home directory of the remote server to the local path (.) Represents the local current path)

$scp-r zbl@202.202.202.202:~/t2_dir.

4. Copy from one user to another on the local server. The following command copies the file from the local user to the zbl using the same server, and changes the ip to localhost.

$scp t1.fasta zbl@localhost:~/

Note that if the server needs to use a special port for security reasons, use the-P parameter, followed by the corresponding port.

Command parameter

-1 force the scp command to use the protocol ssh2

-2 force the scp command to use the protocol ssh3

-4 forces the scp command to use only IPv4 addressing

-6 force the scp command to use only IPv6 addressing

-B uses batch mode (transfer passwords or phrases are not asked during transfer)

-C allows compression. (pass the-C flag to ssh to turn on compression)

-p keep 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 is uppercase P, port is the port number used to specify the data transfer

-S program specifies the program used to encrypt the transmission. This program must be able to understand the options of ssh (1).

This is the end of the article on "how to use the scp command on the command line". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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

Internet Technology

Wechat

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

12
Report