Secure copy
lastmod 2025-11-13created 2016-06-2114 edits
Secure copy, or SCP, is a means of securely transferring computer files between a local host and a remote host or between two remote hosts. It is based on the Secure Shell (SSH) protocol. The term SCP can refer to either the SCP protocol or the SCP program.
How to use
An SCP program is a software tool that implements the SCP protocol as a server daemon or client, a program that performs secure copying. The SCP server program is usually the same as the SCP client.
In general, the syntax of the scp program is similar to that of cp.
Copy a file to a host:
Copy a file from a host:
| WARNING |
| When writing the remote address, you must include the |
Remote -> remote also works:
Flags
-
-r- Recursive, which copies everything including subfolders -
-P- Specify the ssh port -
-p- Preserve, which keeps permissions and attributes -
-c- Compress, which performs compression; these are some of the options. -
-v- Used when debugging while viewing details (verbose mode) -
-i- Use a specified identity file (specify the identity file path)
Example
How to download from an SCP remote to local:
scp -P 8888 [email protected]:/home/yourname/Downloads/backup.sql backup.sql
How to send a local file to a remote
scp install.sh [email protected]:/home/aaa/Downloads/
See also
- OpenSSH
- scp
- rsync
- rclone
- sshfs (Python) - A Python client implementing fsspec. Based on asyncssh.
- SSHFS (FUSE) - A client for mounting that uses FUSE
- Robocopy - Robust file copy for Windows