scp – Secure Copy Protocol

scp (Secure Copy Protocol) is a file transfer utility that uses SSH encryption to securely...

Networking Tools Linux Open Source

scp (Secure Copy Protocol) is a file transfer utility that uses SSH encryption to securely copy files between hosts on a network. As part of the OpenSSH suite, scp provides a simple command-line interface for transferring files while maintaining the security benefits of SSH authentication and encryption.

While scp is being deprecated in favor of sftp and rsync for new deployments, it remains widely used due to its simplicity and ubiquitous availability. Understanding scp is essential for system administrators who manage legacy systems or need quick, secure file transfers.

Key Features

  • SSH Encryption – Secure file transfer over SSH
  • Simple Syntax – Similar to cp command
  • Recursive Copy – Copy entire directories
  • Preserve Attributes – Maintain file permissions and timestamps
  • Compression – Compress data during transfer
  • Key Authentication – Use SSH keys for authentication

Basic Usage Examples

# Copy local file to remote
scp file.txt user@server:/path/to/destination/

# Copy remote file to local
scp user@server:/path/to/file.txt ./

# Copy directory recursively
scp -r /local/directory user@server:/remote/path/

# Preserve file attributes
scp -p file.txt user@server:/path/

# Use specific port
scp -P 2222 file.txt user@server:/path/

# Use compression
scp -C file.txt user@server:/path/

# Use specific SSH key
scp -i ~/.ssh/key.pem file.txt user@server:/path/

Use Cases

  • Server Deployment – Upload configuration files
  • Backup Transfer – Copy backups to remote storage
  • Log Collection – Retrieve logs from remote servers
  • Quick Transfers – Ad-hoc file sharing between systems

View Documentation

Was this article helpful?