SCP

From Gentoo Wiki
(Redirected from Scp)
Jump to:navigation Jump to:search
Not to be confused with SCAP.


Resources

SCP (Secure Copy Program) is an interactive file transfer program, similar to the copy command, that copies files over an encrypted SSH transport. It uses many features of SSH, such as public key authentication and compression.[1]

Note
The OpenSSH 8.0 release notes, from 2019, state "The scp protocol is outdated, inflexible and not readily fixed. We recommend the use of more modern protocols like sftp and rsync for file transfer instead.". The OpenSSH 8.8 release notes, from 2021, state "A near-future release of OpenSSH will switch scp(1) from using the legacy scp/rcp protocol to using SFTP by default.".

Installation

The scp command is part of the net-misc/openssh package, and deployments of Gentoo Linux should already have OpenSSH installed, as the package is part of the system set. The presence and proper functioning of OpenSSH can be checked by running the scp command, which should output a usage statement:

user $scp
usage: scp [-346ABCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file]
            [-J destination] [-l limit] [-o ssh_option] [-P port]
            [-S program] source ... target

If no usage statement is printed, OpenSSH may be corrupt, or not installed. Try re-installation by following the Installation section from the SSH article.

Configuration

For configuration see the configuration section in the SSH article.

Usage examples

Copy a file from a remote computer locally:

user $scp user@somecomputer:/path/file /path/file

Where

  • 'user' is a username on the remote computer. This defaults to the username on the local computer
  • 'somecomputer' is the hostname or the IP address of the remote computer


Copy a local file to a remote computer:

user $scp /path/file user@somecomputer:/path/file

See also

  • SFTP — an interactive file transfer program, similar to FTP, which performs all operations over an encrypted SSH transport.
  • SSHFS — a secure shell client used to mount remote filesystems to local machines.
  • SSH — the ubiquitous tool for logging into and working on remote machines securely.
  • CurlFtpFS — allows for mounting an FTP folder as a regular directory to the local directory tree.

External resources

  • The SCP man page locally (man scp) or online at openbsd.org

References