Linux SCP Command

Source: Internet
Author: User
Tags scp command

Grammar
Scp[-1246BCpqrv] [-C cipher] [-F Ssh_config] [-i identity_file][-< Span class= "PLN" >l limit] [-o ssh_option< Span class= "pun" >] [-p port  [-s program][[[email protected]]host1 :] file1 [...]  [[[email protected] host2:]file2         

Simple notation:

[Optional parameters]

Parameter description:

    • -1: Enforce SCP command using protocol SSH1
    • -2: Enforce SCP command using protocol SSH2
    • -4: Force SCP command to use only IPV4 addressing
    • -6: Force SCP command to use only IPV6 addressing
    • -B: Use batch mode (transfer password or phrase is not asked during transfer)
    • -C: Allow compression. (Pass the-c flag to SSH to turn on the compression function)
    • -P: Preserves the original file's modification time, access time, and access rights.
    • -Q: The transfer progress bar is not displayed.
    • -R: Recursively replicate the entire directory.
    • -V: Displays the output in verbose mode. SCP and SSH (1) will display debugging information for the entire process. This information is used to debug connections, authentication, and configuration issues.
    • -C cipher: To encrypt the data transfer with cipher, this option will be passed directly to SSH.
    • -F Ssh_config: Specifies an alternative SSH configuration file that is passed directly to SSH.
    • -I identity_file: The key file used to read the transfer from the specified file, which is passed directly to SSH.
    • -L Limit: limits the bandwidth that the user 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 specified for data transfer
    • -S Program: Specifies the programs that are used to encrypt the transfer. This program must be able to understand the options for SSH (1).
Instance 1, copying from local to remote

Command format:

SCP local_file [email protected]_ip: or scp local_file [email protected]_ip: or SCP local_file Remote_ip: or SCP local_file remote_ip:           

    • 1th, 2 Specify the user name, command execution after the need to enter the password, the 1th only specifies the remote directory, the file name is unchanged, 2nd specified the file name;
    • 3rd, 4 does not specify a user name, command execution after the need to enter a user name and password, the 3rd only specifies the remote directory, the file name is unchanged, 4th specified the file name;

Application Examples:

Scp/Home/Space/Music/1.mp3[Email protected].W3cschool.Cc:/home/Root/Others/Music SCP/Home/Space/Music/1.mp3[Email protected].W3cschool.Cc:/home/Root/Others/Music/001.mp3Scp/Home/Space/Music/1.mp3 Www.. Cc:/home/root/others /music SCP /home/space/music/1.mp3  Www.. Cc:/home/root/others /music/001.mp3     

Copy Directory command format:

-R local_folder [email protected]_ip: or -R local_folder remote_ip:      
    • The 1th one specifies the user name, the command executes after the need to enter the password;
    • The 2nd does not specify a user name, the command will need to enter the user name and password after execution;

Application Examples:

Scp-R/Home/Space/music/ [email protected] w3cschool.:/home/root/others / SCP -r / home/space/music< Span class= "pun" >/ Www.. Cc:/home/root/others                

The above command copies the local music directory to the remote others directory.

2. Copy from remote to local

From remote replication to local, as long as the following 2 parameter exchange order is copied from the local copy to the remote command, the following example

Application Examples:

SCP [email protected].W3cschool.cc:/home/root/others/music /home /space/music/ 1.mp3 SCP -r www.w3cschool.:/home/root/others //home/space/music/           
Description

1. If the remote server firewall has the specified port set for the SCP command, we need to use the-p parameter to set the port number of the command, as follows:

#scp命令使用端口号 4588-4588 [email protected].  W3cschool.  CC:/usr/local/sin.  /Home/Administrator             

2. Use the SCP command to ensure that the user you are using has permission to read the appropriate files for the remote server, otherwise the SCP command will not work.

Linux SCP Command

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.