Linux/Unix Command: SCP manul

Source: Internet
Author: User
Tags secure copy
Linux/Unix command:SCP
Command Library

SCP-Secure copy (remote file copy program)


SCP[-Pqrvbc46] [-FSsh_config] [-SProgram] [-PPort] [-CCipher] [-IIdentity_file] [-OSsh_option] [[User @]Host1: File1] [...] [[User @]Host2: File2]



SCPCopies files between hosts on a network. It uses SSH (1) for data transfer, and uses the same authentication and provides the same security as SSH (1). Unlike RCP (1 ),SCPWill ask for passwords or passphrases if they are needed for authentication.

Any file name may contain in a host and user specification to indicate that the file is to be copied to/from that host. Copies between two remote hosts are permitted.


Putty free putty now. fast and reliable SSH and sftp.

Edgewave's email securitywww. edgewave. comeprism Secure Email solutions for next generation-request a quote now

Clinicalkey search enginewww. clinicalkey. commost relevant clinical data faster. Try clinicalkey 30-day free trial.

The options are as follows:


-C Cipher
Selects the cipher to use for encrypting the data transfer. This option is directly passed to SSH (1 ).
-I Identity_file
Selects the file from which the identity (Private Key) for RSA Authentication is read. This option is directly passed to SSH (1 ).
Preserves modification times, access times, and modes from the original file.
Recursively copy entire directories.
Verbose mode. Causes SCPAnd SSH (1) to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems.
Selects batch mode (prevents asking for passwords or passphrases ).
Disables the progress meter.
Compression enable. Passes- CFlag to SSH (1) to enable compression.
-F Ssh_config
Specifies an alternative per-user configuration file SSHThis option is directly passed to SSH (1 ).
-P Port
Specifies the port to connect to on the remote host. Note that this option is written with a capital 'P' because- PIs already reserved for preserving the times and modes of the file in RCP (1 ).
-S Program
Name ProgramTo use for the encrypted connection. The program must understand SSH (1) options.
-O Ssh_option
Can be used to pass options SSHIn the format used in ssh_config5. This is useful for specifying options for which there is no separate SCPCommand-line flag. For example, forcing the use of Protocol Version 1 is specified using SCP-oprotocol = 1
Forces SCPTo use IPv4 addresses only.
Forces SCPTo use IPv6 addresses only.

Secure copyOrSCPIs a means of securely transferring computer files between a local host and a remote host or between two remote hosts. It is based on the Secure Shell (SSH) protocol.

The term SCP can refer to one of two related things,SCP ProtocolOrSCP Program.

  • 1 SCP Protocol

    • 1.1 how it works
    • 1.2 remote to remote mode
    • 1.3 issues using talkative shell profiles
  • 2 SCP Program
  • 3 See also
  • 4 references
SCP Protocol

TheSCP ProtocolIs a network protocol, based on the bsd rcp protocol,[1] which supports file transfers between hosts on a network. SCP uses Secure Shell (SSH) for data transfer and uses the same mechanic ISMs for authentication, thereby ensuring the authenticity and confidentiality of the data in transit. A client can send (upload) files to a server, optionally including their basic attributes (permissions, timestamps ). clients can also request files or directories from a server (download ). SCP runs over TCP port 22 by default. like RCP, there is no RFC that defines the specifics of the Protocol.

How it works

Normally, a client initiates an SSH connection to the remote host, and requests an SCP process to be started on the remote server. the remote SCP process can operate in one of two modes: Source mode, which reads files (usually from disk) and sends them back to the client, or sink mode, which accepts the files sent by the client and writes them (usually to disk) on the remote host. for most SCP clients, source mode is generally triggered with the-F flag (from), while sink mode is triggered with-T ().[2] these flags are used internally and are not supported ented outside the SCP source code.

Remote to remote mode

In remote-to-remote secure copy, the SCP client opens an SSH connection to the source host and requests that it, in turn, open an SCP connection to the destination. (Remote-to-remote mode does not operate by opening two SCP connections and using the originating client as an intermediary ). it is important to note that SCP cannot be used to remotely copy from the source to the destination when operating in password or keyboard-Interactive Authentication mode, as this wowould reveal the destination server's authentication credentials to the source. it is, however, possible with key-based or gssapi methods that do not require user input.[2]

Issues using talkative shell profiles

SCP does not properly CT text communicating with the SSH Login Shell. text transmitted due to the SSH profile (e.g. echo "welcome" in. bashrc file) is intrepreted as an error message, and a Null Line (echo "") causes SCP to deadlock waiting for the error message to complete.[2]

SCP Program

TheSCP ProgramIs a software tool implementing the SCP protocol as a service daemon or client. It is a program to perform secure copying. The SCP server program is typically the same program as the SCP client.

Perhaps the most widely used SCP program is the command lineSCPProgram, which is provided in most SSH implementations.SCPProgram is the secure analog ofRCPCommand.SCPProgram must be part of all SSH servers that want to provide SCP service,SCPFunctions as SCP server too.

Some SSH implementations provideSCP2Program, which uses the SFTP protocol instead of SCP, but provides the very same command line interfaceSCP.SCPIs then typically a symbolic linkSCP2.

Typically, a syntaxSCPProgram is like the syntaxCP:

Copying file to Host:

scp SourceFile user@host:directory/TargetFile

Copying file from host:

scp user@host:directory/SourceFile TargetFilescp -r user@host:directory/SourceFolder TargetFolder

Note that if the remote host uses a port other than the default of 22, it can be specified in the command. For example, copying a file from host:

scp -P 2222 user@host:directory/SourceFile TargetFile

As the SCP protocol implements file transfers only, Gui SCP clients are rare, as implementing it requires additional functionality (directory listing at least ). for example, winscp defaults to the SFTP protocol. even when operating in SCP mode, clients like winscp are typically not pure SCP clients, as they must use other means to implement the additional functionality (likeLsCommand). This in turn brings platform-dependency problems.

More comprehensive tools for managing files over SSH are sftp clients.

Related Article

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: 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.