SCP

scp copies 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), scp will ask for passwords or passphrases if they are needed for authentication.

File names may contain a user and host specification to indicate that the file is to be copied to/from that host. Local file names can be made explicit using absolute or relative pathnames to avoid scp treating file names containing ‘:’ as host specifiers. Copies between two remote hosts are also permitted.

When copying a source file to a target file which already exists, scp will replace the contents of the target file (keeping the inode).

If the target file does not yet exist, an empty file with the target file name is created, then filled with the source file contents. No attempt is made at “near-atomic” transfer using temporary files.

Usage:

scp [option] [user@]SRC_HOST:]file1 [user@]DEST_HOST:]file2

[user@]SRC_HOST:]file1 – Source file.

[user@]DEST_HOST:]file2 – Destination file

Options

-1’Forces scp to use protocol 1.

-2′ Forces scp to use protocol 2.

-4′ Forces scp to use IPv4 addresses only.

-6′ Forces scp to use IPv6 addresses only.

-B’ Selects batch mode (prevents asking for passwords or passphrases).

-C’ Compression enable. Passes the -C flag to ssh to enable compression.

-c cipher

Selects the cipher to use for encrypting the data transfer. This option is directly passed to ssh.

-F ssh_config

Specifies an alternative per-user configuration file for ssh. This option is directly passed to ssh.

-i identity_file

Selects the file from which the identity (private key) for public key authentication is read. This option is directly passed to ssh.

-l limit

Limits the used bandwidth, specified in Kbit/s.

-o ssh_option

Can be used to pass options to ssh in the format used in ssh_config. This is useful for specifying options for which there is no separate scp command-line flag.

-P port

Specifies the port to connect to on the remote host. Note that this option is written with a capital ‘P’, because -p is already reserved for preserving the times and modes of the file in rcp.

-p’ Preserves modification times, access times, and modes from the original file.

-q’ Quiet mode: disables the progress meter as well as warning and diagnostic messages from ssh.

-r’ Recursively copy entire directories. Note that scp follows symbolic links encountered in the tree traversal.

-S program

Name of program to use for the encrypted connection. The program must understand ssh options.

-v’ Verbose mode. Causes scp and ssh to print debugging messages about their progress. This is helpful in debugging connection, authentication, and configuration problems.

The scp utility exits 0 on success, and >0 if an error occurs.