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.
- SSH access configured - See SSH access guide
- SSH key pair set up - See SSH key setup
- SCP installed - Usually pre-installed on Linux/macOS, via WSL on Windows
which scp
# If installed, it will show the path
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/ ./
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:
| Feature | SCP | SFTP | rsync |
|---|---|---|---|
| Security | SSH encrypted | SSH encrypted | SSH encrypted |
| Resumable transfers | No | Yes | Yes |
| Bandwidth limiting | Yes | Limited | Yes |
| Directory sync | Basic | Manual | Advanced |
| Progress indication | Limited | Yes | Yes |
| File comparison | No | Manual | Automatic |