How to Securely Copy Files Over SSH (scp)

scp copies files between hosts over an encrypted SSH connection, using the same authentication as a normal SSH login.

Published September 30, 2026

scp copies files between hosts over an encrypted SSH connection, using the same authentication as a normal SSH login.

Key points

  • scp file.txt user@server:/remote/path copies a local file to a remote server
  • scp user@server:/remote/file.txt . copies a file from a remote server to the current local directory
  • scp -r copies an entire directory recursively

Example

scp -P 22 ./backup.tar.gz user@server:/home/user/
More Linux articles