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...")  | 
			
(No difference) 
 | 
Revision as of 12:42, 21 April 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
<syntaxhighlight lang="bash"> scp [options] [source] [destination] </syntaxhighlight>
Examples
Copy a local file to a remote server:
<syntaxhighlight lang="bash"> scp file.txt user@remote_host:/remote/directory/ </syntaxhighlight>
Copy a file from a remote server to the local machine:
<syntaxhighlight lang="bash"> scp user@remote_host:/remote/file.txt /local/directory/ </syntaxhighlight>
Copy an entire directory recursively:
<syntaxhighlight lang="bash"> scp -r /local/folder user@remote_host:/remote/directory/ </syntaxhighlight>
Use a custom port (e.g., 2222):
<syntaxhighlight lang="bash"> scp -P 2222 file.txt user@remote_host:/remote/path/ </syntaxhighlight>
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