Skip to main content
Browse documentation

Copy files with SCP

Use a current OpenSSH SCP client that transfers over SFTP. Configure the cn-backup SSH alias first.

Upload​

scp ./archive.tar.gz cn-backup:/data/archive.tar.gz
scp -r ./photos cn-backup:/data/

Download​

scp cn-backup:/data/archive.tar.gz ./downloaded-archive.tar.gz
scp -r cn-backup:/data/photos ./downloaded-photos

Choose a new local destination if you want to preserve existing files. SCP may overwrite a file with the same name.

Without an SSH alias​

Replace the host and port below with your own connection details:

scp -P YOUR_ASSIGNED_PORT -i ~/.ssh/caliber-storage \
./archive.tar.gz storage@YOUR_STORAGE_HOST:/data/

SCP's port option is uppercase -P; lowercase -p preserves file times and modes. Do not add -O: it requests the legacy SCP protocol. If an older client cannot connect, upgrade it or use the SFTP guide.

Verify a transfer​

Download the uploaded file under a different name and compare hashes:

sha256sum archive.tar.gz downloaded-archive.tar.gz

On macOS use shasum -a 256. In PowerShell use Get-FileHash -Algorithm SHA256 for each file. Matching hashes confirm that the two files contain the same bytes.

See the OpenSSH SCP manual for command options.