scp and SFTP are no longer competing protocols. Since OpenSSH 9.0 (April 2022), the scp command uses the SFTP protocol by default while keeping its familiar syntax. The legacy SCP protocol only kicks in with -O. For safe file transfers, run scp without -O or use sftp. Both are encrypted over SSH.
What changed in scp with OpenSSH 9.0 and why it matters
Since OpenSSH 9.0, released in April 2022, scp talks SFTP to the server instead of the old SCP protocol. The command line is unchanged: scp source destination, -r for directories, -P for the port. What changes is what happens on the server.
The legacy SCP protocol started scp on the server through a remote shell and handed it the path as plain text. That had two consequences:
- The remote shell interpreted wildcards and quotes its own way.
- The client had to trust whatever filenames the server sent back.
In SFTP mode, paths travel as protocol data rather than shell arguments, so that remote interpretation goes away.
Both protocols are encrypted inside the SSH connection, which OpenSSH serves by default on TCP port 22. The security difference is not the encryption but the design: legacy SCP depends on the remote shell, and SFTP does not.
scp and sftp syntax: real commands to upload, download and resume
scp and sftp take an uppercase -P for the port, while ssh takes a lowercase -p. That mix-up is the most common mistake. These commands work with any current OpenSSH:
# Upload a file to a non-standard port (uppercase -P)
scp -P 2222 backup.tar.gz admin@server:/srv/backups/
# Download a whole directory, preserving times and modes (-r, -p)
scp -rp admin@server:/var/log/nginx ./nginx-logs
# Copy between two servers, routing through your machine
scp -3 web1:/etc/nginx/nginx.conf web2:/tmp/
# Force the legacy SCP protocol (only if the server lacks SFTP)
scp -O firmware.bin [email protected]:/tmp/
# Interactive sftp session
sftp -P 2222 admin@server
sftp> ls -la /srv/backups
sftp> reget /srv/backups/backup.tar.gz
sftp> put -r ./dist /var/www/app
sftp> rm /srv/backups/old.tar.gz
# The same commands, non-interactive, from a batch file
sftp -b commands.txt admin@serverSFTP mode changes two syntax details. A remote filename with spaces no longer needs double escaping: quoting it once in your local shell is enough (scp 'server:/srv/my report.pdf' .). Also, ~user/ paths only work if the SFTP server supports path expansion. If it doesn't, use the absolute path. Every flag is documented in the scp manual page.
scp, scp -O and sftp: comparison table of features and limits
scp is still a copy-only command: it doesn't list, delete or resume. sftp does all three. Here is what each variant offers:
| Capability | scp (default) | scp -O (legacy) | sftp |
|---|---|---|---|
| Transfer protocol | SFTP over SSH | SCP over SSH, through a remote shell | SFTP over SSH |
| Who interprets paths and wildcards | The client, no remote shell | The server's remote shell | The client, no remote shell |
| Needs the SFTP subsystem on the server | Yes | No | Yes |
| Resume interrupted transfers | No | No | Yes, with reget and reput |
| List, rename or delete | No | No | Yes: ls, rename, rm |
| Remote-to-remote copy | Yes, with -3 | Yes, with -3 | No |
| Scripting | A single line | A single line | With -b and a batch file |
When to use scp -O: servers without the SFTP subsystem
scp -O is only needed when the server doesn't offer the SFTP subsystem. That happens on embedded devices, routers, NAS boxes with stripped-down firmware, or servers where someone disabled the Subsystem line in sshd_config. The typical symptom: scp worked from an older client and fails to connect from an updated one.
If you control the server, the right fix is to enable the subsystem and reload sshd, not to use -O forever:
# /etc/ssh/sshd_config
Subsystem sftp internal-sftpIf you don't control the server, use -O for that host only, and only with files whose names you know. That limits what the remote shell can interpret its own way.
scp and SFTP from your phone: transfers on iOS and Android
On a phone, scp and SFTP always run over SSH, usually on port 22, never over Mosh. Mosh uses UDP on ports 60000-61000, starts mosh-server through an initial SSH connection and does no port forwarding. Mosh keeps the terminal alive, but transfers need their own SSH connection.
termi1 gives you two routes:
- Commands in the session: you run
scporsftpfrom one server to another. termi1's own keyboard supplies Tab for path completion, plus Ctrl and arrow keys to recall the previous command. - Built-in SFTP: you browse, upload and download files between the phone and the server without leaving the session.
If you tell termi1's AI "copy nginx.conf from web1 to web2", it types the scp -3 into the prompt without pressing Enter. You check the port and path, then decide whether it runs. On connections tagged as production, Production Guard ensures nothing gets Enter automatically. For a long copy, start it inside tmux on the server: it keeps running even if the phone hops from Wi-Fi to mobile data.
SSH keys are generated on the phone itself and stored in the system's secure keystore. The private key never leaves the device. For servers without a public IP, a private mesh network avoids exposing port 22 to the internet. Find out more about the mobile SSH and SFTP terminal, which you can download free from the App Store.
Frequently asked questions
Is scp still safe to use in 2026?
scp is safe to use in 2026 in its default mode. Since OpenSSH 9.0, it transfers files over the SFTP protocol, encrypted inside SSH, without the remote shell interpreting paths. The risk lies in the legacy SCP protocol, which is only enabled with the -O option.
What does the scp -O option do?
The scp -O option forces the legacy SCP protocol instead of SFTP. It is meant for servers without the SFTP subsystem, such as some embedded devices. With it, the remote shell interprets paths and wildcards again, so restrict it to specific hosts and known filenames.
Why does scp fail against a server that used to work?
scp fails against a server that used to work when the client runs OpenSSH 9.0 or later and the server doesn't offer the SFTP subsystem. The client tries SFTP and the server refuses it. Enable Subsystem sftp in sshd_config or, if you can't, retry the copy with scp -O.
Can scp resume an interrupted transfer?
scp cannot resume an interrupted transfer: it copies the whole file again. To resume, open sftp and use reget for downloads or reput for uploads, which continue from the portion already transferred. If your phone's connection is unstable, run sftp inside tmux on the server.