Difference between revisions of "SCP"
 (Created page with "== SCP (Secure Copy Protocol) ==  '''SCP''' (''Secure Copy Protocol'') is a command-line utility used to securely transfer files and directories between two computers over a n...")  | 
				 (→Information)  | 
				||
| Line 14: | Line 14: | ||
=== Basic Syntax ===  | === Basic Syntax ===  | ||
| − | + | ||
| − | scp [options] [source] [destination]  | + |   scp [options] [source] [destination]  | 
| − | + | ||
=== Examples ===  | === Examples ===  | ||
| Line 22: | Line 22: | ||
'''Copy a local file to a remote server:'''  | '''Copy a local file to a remote server:'''  | ||
| − | + | ||
| − | scp file.txt user@remote_host:/remote/directory/  | + |   scp file.txt user@remote_host:/remote/directory/  | 
| − | + | ||
'''Copy a file from a remote server to the local machine:'''  | '''Copy a file from a remote server to the local machine:'''  | ||
| − | + | ||
| − | scp user@remote_host:/remote/file.txt /local/directory/  | + |   scp user@remote_host:/remote/file.txt /local/directory/  | 
| − | + | ||
'''Copy an entire directory recursively:'''  | '''Copy an entire directory recursively:'''  | ||
| − | + | ||
| − | scp -r /local/folder user@remote_host:/remote/directory/  | + |   scp -r /local/folder user@remote_host:/remote/directory/  | 
| − | + | ||
'''Use a custom port (e.g., 2222):'''  | '''Use a custom port (e.g., 2222):'''  | ||
| − | + | ||
| − | scp -P 2222 file.txt user@remote_host:/remote/path/  | + |   scp -P 2222 file.txt user@remote_host:/remote/path/  | 
| − | + | ||
=== SCP vs SFTP ===  | === SCP vs SFTP ===  | ||
Revision as of 13:34, 19 May 2025
Contents
SCP (Secure Copy Protocol)
SCP (Secure Copy Protocol) is a command-line utility used to securely transfer files and directories between two computers over a network. It uses the SSH (Secure Shell) protocol to provide encryption and authentication, ensuring data confidentiality during transit.
SCP is available by default on most Unix-like operating systems, including Linux, macOS, and FreeBSD, and is widely used for remote file transfers to and from servers, including seedboxes, VPS servers, and cloud platforms.
Key Features
- **Encrypted transfer** – Uses SSH to securely transmit files
 - **Authentication** – Supports password and public key login
 - **Fast and reliable** – Good performance for bulk file transfers
 - **Cross-platform support** – Available on Linux, macOS, and Windows (via third-party clients)
 
Basic Syntax
scp [options] [source] [destination]
Examples
Copy a local file to a remote server:
scp file.txt user@remote_host:/remote/directory/
Copy a file from a remote server to the local machine:
scp user@remote_host:/remote/file.txt /local/directory/
Copy an entire directory recursively:
scp -r /local/folder user@remote_host:/remote/directory/
Use a custom port (e.g., 2222):
scp -P 2222 file.txt user@remote_host:/remote/path/
SCP vs SFTP
While both SCP and SFTP use SSH and offer secure file transfers, there are key differences:
| Feature | SCP | SFTP | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Protocol | SSH-based | SSH-based | File transfer | Direct (fast, limited features) | Interactive (supports resume, list, delete) | Directory browsing | No | Yes | Resume transfers | No | Yes | GUI clients | Limited | Widely supported | Speed | Slightly faster | More robust | Scriptable | Yes | Yes | 
Use Cases
- Uploading files to a remote server or seedbox
 - Backing up configuration files from a remote VPS
 - Securely copying logs, media, or documents over SSH
 - Automating transfers with shell scripts or cron jobs
 
SCP Clients
- Native on Linux/macOS: `scp` in the terminal
 - Windows: Use via
 
* PuTTY tools (e.g., `pscp.exe`) * WinSCP GUI client * MobaXterm with SCP integration
Security Considerations
- SCP inherits the security of SSH (strong encryption and authentication)
 - Use SSH keys instead of passwords for improved security
 - Ensure remote servers are configured with strong access controls and updated software
 
Deprecation Note
OpenSSH has deprecated the legacy SCP protocol in newer versions due to protocol vulnerabilities. The `scp` command still functions but may internally use SFTP when available. Users are encouraged to transition to `sftp` or `rsync` over SSH for secure, modern transfers.
Alternatives
- SFTP – Secure File Transfer Protocol
 - rsync – Efficient file synchronization over SSH
 - WebDAV – File access over HTTP/HTTPS
 - FTP/FTPS – Legacy file transfer protocols