Catalog / SCP Cheatsheet
SCP Cheatsheet
A comprehensive guide to using Secure Copy (SCP) for transferring files between systems, covering essential options, usage examples, and security considerations.
SCP Basics
SCP Overview
SCP (Secure Copy) is a command-line utility that allows you to securely transfer files and directories between two locations. It uses SSH for data transfer, providing confidentiality and integrity of the data. |
SCP is commonly used for:
|
Basic Syntax
The basic syntax for SCP is:
Where:
|
Source and Destination Paths
Local to Remote |
|
Remote to Local |
|
Remote to Remote |
|
Common SCP Options
Essential Options
|
Recursively copy entire directories. |
|
Verbose mode; displays debugging messages. |
|
Enable compression during transfer. |
|
Preserves modification times, access times, and modes from the original file. |
|
Quiet mode; suppresses warning and diagnostic messages. |
Advanced Options
|
Specifies the port to connect to on the remote host. Default is 22. |
|
Limits the bandwidth used by SCP, specified in Kbit/s. |
|
Selects the file from which the identity (private key) for public key authentication is read. |
SCP Examples
Basic File Transfers
Copy a local file to a remote directory:
|
Copy a remote file to a local directory:
|
Advanced Examples
Copy a directory recursively to a remote system:
|
Copy a file with compression:
|
Limit bandwidth during file transfer:
|
Copying a file using a specific identity file:
|
Security Considerations
Secure Authentication
Always use strong passwords or SSH keys for authentication.
|
File Permissions
Ensure proper file permissions are set on both the source and destination systems.
|
Network Security
Secure the network connection between the local and remote systems.
|