Cookies ahead

Our support chat tool "Intercom" would like to collect some more data on you. See the related link for more details.

Docs

Using Secure Copy

Reviewedbyfl

Markdown ↓

🔐

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

To transfer files securely using SCP with your fortrabbit application, ensure you have each of these three prerequisites: SSH access configured on your fortrabbit account, an SSH key pair set up and registered with fortrabbit, and the SCP utility installed on your local system.

  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

Examples

Here are common SCP commands for uploading files to your fortrabbit application and downloading files from the remote server to your local machine:

# 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

SCP is effective for straightforward file transfers, but comparing it to SFTP and rsync reveals key differences in features and capabilities that make each tool better suited for different scenarios and use cases with your fortrabbit applications:

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

Written by a human. Review, grammar checks and typo fixes by AI.

AI use & editorial processEdit on GitHub ↗