Show Contents / Index / Search

scp Command Line Utility

Syntax: scp [options] [user@host:]file1 [user@host:]file2

The scp command line utility copies files securely between hosts on a network. It uses Secure Shell sftp subsystem for data transfer, and uses the same authentication and provides the same security as Secure Shell. Scp will ask for passwords or passphrases if they are needed for authentication. Any file name may contain a host and user specification to indicate that the file is to be copied to/from that host.


This command line copies the file f1 from the host to the local machine and gives it the name f2:

scp user@host:f1 f2

This command copies the local file f1 to f2 on the remote host.

scp f1 user@host:f2

Note:You can reuse an existing SecureShell connection, however to do so you must explicitly enable this on each command line, or set the SSHConnectionReUse environment variable to Yes. For details, see Connection Reuse in Secure Shell Sessions.


The following options are available


Transfer files in ASCII mode.

-b buffersize

Sets the maximum buffer size for one request.


Sets batch mode on, which prevents asking for passwords or passphrases. Use passphraseless user keys in order to authenticate.

-c cipher

Protocol version 1 allows specification of a single cipher. The supported values are "3des", "blowfish", and "des".

For protocol version 2, a comma-separated list of ciphers can be specified in order of preference. Multiple ciphers must be comma-separated. The default is "aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour, aes192-cbc,aes256-cbc". If the connection is set to run in FIPS mode, the default is "aes128-cbc,3des-cbc".


Enable compression.


Force target to be a directory.

-F configfile

Specifies an alternative per-user configuration file. If a configuration file is given on the command line, the system-wide configuration file will be ignored.

-H scheme

Specifies which SSH config scheme to use for this connection.

-i keyfile

Selects a file from which the identity (private key) for RSA or DSA authentication is read. Identity files may also be specified on a per-host basis in the configuration file. It is possible to have multiple -i options (and multiple identities specified in a configuration file). Path names containing spaces must be embedded inside double quotation marks.

-k directory

Sets a non-default folder for configuration file, host keys and user keys.

-l limit

Limit the bandwith to the value specified (in Kb).

-o option

Can be used to give options in the format used in the configuration file. This is useful for specifying options for which there is no separate command-line flag. For a list of supported options, see the Configuration Keyword Reference.


Preserve time stamps and file attributes.

-P port

Port to connect to on the remote host.


Quiet mode. Causes all warning and diagnostic messages, including banners, to be suppressed.


Copy directories recursively, including all subdirectories.


Remove the source file after copying.


Verbose mode. Causes ssh to display debugging messages about its progress. This is helpful in debugging connection, authentication, and configuration problems. Multiple -v options increases the verbosity. Maximum is 3 (-vvv).


Display the version number and application information.


Forces protocol version 1 only. This option also transfers file to OpenSSH servers using rcp through the ssh -2 tunnel.


Forces protocol version 2 only.


Use only IPv4 addresses.


Use only IPv6 addresses.