Overview
Secure Copy (commonly called scp) is a method and command-line utility used to copy files between hosts on a network while protecting data with the Secure Shell protocol. It provides encrypted transport and uses SSH for authentication, confidentiality, and integrity, making it suitable for transferring sensitive files across untrusted networks.
How it works
SCP operates by initiating an SSH connection to a remote system and then sending file data through that channel. The underlying SSH layer handles host verification and user authentication (passwords, public keys, or other SSH methods). The user typically invokes a client command such as scp source destination to move single files or directories, and options exist to perform recursive copies, specify ports, or pass identity files.
Characteristics and common options
- Encryption and authentication: relies on SSH for secure transport.
- Simple syntax: source and destination can be local paths or user@host:path.
- Recursion and permissions: supports copying directories and preserving attributes with flags.
- Implementation differences: various SSH implementations may include slightly different options or behavior.
Usage examples and tips
Typical uses include copying a file from a workstation to a server, retrieving logs, or moving backups between systems. Basic examples show the form scp localfile user@remote:/path/. To copy recursively use a recursive flag; to use a custom SSH key or port, specify the appropriate options for the client. For more general guidance consult resources on secure file transfer and SSH: file transfer overview and SSH protocol basics.
History and evolution
SCP originated as a convenience wrapper around SSH to enable encrypted copies where older tools used unencrypted channels. Over time implementations and best practices have evolved. Some modern SSH distributions revised the scp client to rely on more robust file-transfer subsystems or recommended alternatives because the original protocol had limitations in error reporting and transfer control.
Alternatives and security considerations
While scp remains widely available, administrators often compare it with alternatives such as SFTP (SSH File Transfer Protocol) and rsync over SSH. SFTP provides a richer, extensible protocol for remote file operations, and rsync adds delta-transfer efficiency for synchronizing large datasets. When choosing a tool, evaluate requirements for performance, resumable transfers, directory operations, and strict security policies. Always keep SSH software up to date and prefer public-key authentication and host verification to reduce risk.
Notable facts
- SCP is fundamentally an SSH-based transfer; its security depends on the SSH implementation and configuration.
- Behavior and available options can vary between operating systems and SSH distributions.
- For repeated or large synchronizations, tools that offer checksums or incremental transfers can be more efficient.