Using Secure Copy

🔐

Copy files over SSH.

SCP (Secure Copy Protocol) enables secure file transfers between your local machine and remote servers using SSH encryption.

About SCP

scp (Secure Copy Protocol) is a command-line utility for securely transferring files between a local host and a remote host over SSH. It provides the same authentication and security as SSH while enabling efficient file copying operations.

  • Encrypted file transfers using SSH
  • Preserves file permissions and timestamps
  • Supports recursive directory copying
  • Works with SSH key authentication
  • Available on most Unix-like systems (Linux, macOS)

We suggest to use rsync instead of scp. It's more flexible with more features. It can upload directories.

Get ready

Before using SCP with fortrabbit, ensure you have:

  1. SSH access configured - See SSH access guide
  2. SSH key pair set up - See SSH key setup
  3. SCP installed - Usually pre-installed on Linux/macOS, via WSL on Windows
which scp
# If installed, it will show the path
shell
https://dash.fortrabbit.com/environments/{{app-env-id}}/ssh/

Examples

# Upload

## Upload a file to the web root
scp local-file.php {{app-env-id}}@ssh.{{region}}.frbit.app:

## Upload with verbose output
scp -v config.json {{app-env-id}}@ssh.{{region}}.frbit.app:

## Upload multiple files at once
scp file1.php file2.css file3.js {{app-env-id}}@ssh.{{region}}.frbit.app:

## Upload with wildcards
scp *.php {{app-env-id}}@ssh.{{region}}.frbit.app:


# Download

## Download a file from the web root
scp {{app-env-id}}@ssh.{{region}}.frbit.app:config.php ./

## Download to a specific local path
scp {{app-env-id}}@ssh.{{region}}.frbit.app:.env ./local-config/

## Download log files (Craft CMS)
scp -r {{app-env-id}}@ssh.{{region}}.frbit.app:storage/logs/ ./
bash

Common options

  • -r - Recursive copy (for directories)
  • -p - Preserve file permissions and timestamps
  • -v - Verbose output for debugging

Comparison with other tools

FeatureSCPSFTPrsync
SecuritySSH encryptedSSH encryptedSSH encrypted
Resumable transfersNoYesYes
Bandwidth limitingYesLimitedYes
Directory syncBasicManualAdvanced
Progress indicationLimitedYesYes
File comparisonNoManualAutomatic

Found a tpyo?Edit