Use it for quick file copies between hosts, or when a copy fails.
SCP
1. ssh user@host true — plain SSH works?
2. Copy with scp -v to see errors.
3. Breaks with protocol errors → remove output from ~/.bashrc on the server.
4. Permissions on the target directory?
5. Large/repeated → rsync -avP -e ssh.
ssh connection → authenticated → file stream over the SSH channel → written on the target
For SSH → SCP, continue with the first unproven Topic check: Record OpenSSH version, SCP mode/options, exact source/destination and transfer direction. If that boundary is healthy, advance to the adjacent check: Verify SSH auth first, then local and remote path existence/permissions/space independently. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
scp invocation/mode → SSH transport/auth → source path/read → transfer subsystem/protocol → destination path/write → close/metadata → file verification → consumer workload
Healthy evidence: SSH transport authenticates, source and destination paths resolve as intended, transfer completes without errors and destination content/metadata meet explicit acceptance checks.
Step 2 Verification and output interpretation Verify boundary
For tunneling/SFTP/SCP, verify the requested channel/subsystem after authentication rather than assuming login success shows every SSH feature.
Existing fast checks for this Topic. - Record OpenSSH version, SCP mode/options, exact source/destination and transfer direction.
- Verify SSH auth first, then local and remote path existence/permissions/space independently.
- Capture transfer exit status and server-side errors for the same attempt.
- Validate destination file size/hash/ownership/mode according to the actual acceptance requirement.
Verification chain. scp invocation/mode → SSH transport/auth → source path/read → transfer subsystem/protocol → destination path/write → close/metadata → file verification → consumer workload
Step 3 Commands Verify boundary
scp file user@host:/tmp/
scp -r dir user@host:/srv/
Step 4 Failure modes and next checks Narrow the fault
Step 5 Common mistakes Narrow the fault
- Expecting scp to resume or preserve ACLs (use rsync).
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Uses the same authentication as ssh. Output from shell startup files (echo in ~/.bashrc) can break transfers. For large or repeated copies use rsync over SSH, which can resume and copy only changes.
ssh -v user@host— client-side connection and authentication stepsjournalctl -u ssh -u sshd -e— server logsshd -T— effective server settingsss -ltnp | grep :22— sshd listening
ReferenceWhat it is1 section · depth on demand
Core model
Pin client version/mode, source and destination syntax, remote user/path and direction. Separate SSH transport/authentication from local/remote path expansion and filesystem permissions, then verify resulting file identity, size/hash/metadata as required rather than relying on progress output alone.
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
SCP command success shows a bounded transfer result; it does not automatically show cryptographic content identity, desired ownership/mode or downstream consumer usability.
In depth
scp: copying files over SSH
scp copies files between hosts over an SSH connection. The scp(1) manual page notes an important change: since OpenSSH 9.0, scp uses the SFTP protocol for transfers by default. -O switches back to the legacy SCP protocol, which may be needed for servers without SFTP or for older wildcard and ~ behaviour.
Options (manual)
| Option | Purpose |
|---|---|
-r | Copy directories recursively (follows symbolic links) |
-p | Preserve modification and access times and mode bits |
-P <port> | Port (capital P, because -p is taken) |
-i <key> | Identity file |
-J <jump> | Jump hosts |
-l <kbit/s> | Bandwidth limit |
-C | Compression |
-3 | Copy between two remote hosts through the local host (the default) |
-O | Legacy SCP protocol |
Remote to remote
By default, a copy between two remote hosts goes through the local machine. With -R, the copy runs directly between the two remote hosts, so the first host must be able to authenticate to the second without a password.
Quoting and wildcards
With the legacy protocol, the remote shell expands wildcards, so special characters need careful quoting. scp also rejects received file names that don't match what was requested, unless -T is used. That check exists because a malicious server could otherwise send unexpected files.
admin$ scp -p backup-2026-11-28.tar.gz srv1:/srv/backup/
admin$ scp -r -J bastion srv-db1:/var/log/postgresql ./db1-logs/
admin$ scp -P 2222 -i ~/.ssh/id_ed25519_work config.yml admin@10.30.0.11:/etc/app/
admin$ scp -l 20000 large.iso srv1:/srv/iso/
admin$ scp srv1:'/var/log/nginx/access.log.*.gz' ./
admin$ scp -O oldappliance:/cfg/running.cfg ./
scp, sftp or rsync
| Need | Tool |
|---|---|
| A quick one-off copy | scp |
| Interactive browsing, resuming, batch scripts | sftp |
| Large trees, repeated syncs, only changed files | rsync -e ssh |
scp has no resume and no delta transfer. For anything you'll repeat or that is large, rsync over SSH is usually the better tool.
Documented example, not captured output.
How it works at runtime
Topic-specific state model. SCP is an SSH-based file-copy workflow whose transport may use modern SFTP semantics depending on OpenSSH version/options; transfer success depends on SSH authentication plus source/destination path interpretation, permissions, space and write/read completion.
Interpretation rule. - SSH login works ≠ SCP path/permission semantics work.
- Transfer command exits successfully ≠ file content/metadata matches acceptance criteria.
- Remote path string ≠ same expansion rules across shells/protocol modes.
- SCP name ≠ legacy SCP wire protocol is necessarily being used by modern OpenSSH.
Quick reference
SCP copies files over SSH. Since OpenSSH 9.0, scp uses the SFTP protocol by default (the legacy SCP protocol had design flaws).
scp -p report.csv alice@web01:/tmp/
scp -r -J bastion ./site ops@10.0.30.15:/srv/www/
scp -O old-server:/file . # force legacy protocol for very old servers
For large or repeated transfers prefer rsync -aP -e ssh (resumable, only differences).
Limits and how it fails
Primary failure point. SCP command success shows a bounded transfer result; it does not automatically show cryptographic content identity, desired ownership/mode or downstream consumer usability.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in SSH → SCP. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.openssh.com/manual.html · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
SCP operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for SCP.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | SCP is an SSH-based file-copy workflow whose transport may use modern SFTP semantics depending on OpenSSH version/options; transfer success depends on SSH authentication plus source/destination path interpretation, permissions, space and write/read completion. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin exact client/server + attempt time → resolve destination/TCP path → inspect effective client config → identify OpenSSH versions → verify KEX + host-key trust → trace offered/accepted authentication → inspect effective sshd policy for user/source → verify session/subsystem/forward → verify remote process/filesystem/service → repeat original workload. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | scp invocation/mode → SSH transport/auth → source path/read → transfer subsystem/protocol → destination path/write → close/metadata → file verification → consumer workload | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | SCP command success proves a bounded transfer result; it does not automatically prove cryptographic content identity, desired ownership/mode or downstream consumer usability. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux SSH evidence can establish this proof path: scp invocation/mode → SSH transport/auth → source path/read → transfer subsystem/protocol → destination path/write → close/metadata → file verification → consumer workload | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove behavior outside the captured transport, trust, authentication, policy, session, filesystem or workload scope. SCP command success proves a bounded transfer result; it does not automatically prove cryptographic content identity, desired ownership/mode or downstream consumer usability. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven boundary: correlate client and server evidence for the same attempt, inspect effective client/server configuration and identity/trust/authentication state, then test the exact requested session, transfer or forward before changing additional layers. | Continue to the next unresolved boundary while preserving the original test condition. |
SCP · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | SCP |
|---|---|
| Topic path | SSH → SCP |
| Runtime state | SCP is an SSH-based file-copy workflow whose transport may use modern SFTP semantics depending on OpenSSH version/options; transfer success depends on SSH authentication plus source/destination path interpretation, permissions, space and write/read completion. |
| Fast checks | - Record OpenSSH version, SCP mode/options, exact source/destination and transfer direction. - Verify SSH auth first, then local and remote path existence/permissions/space independently. - Capture transfer exit status and server-side errors for the same attempt. - Validate destination file size/hash/ownership/mode according to the actual acceptance requirement. |
| Verification chain | scp invocation/mode → SSH transport/auth → source path/read → transfer subsystem/protocol → destination path/write → close/metadata → file verification → consumer workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary. |
| Failure boundary | SCP command success proves a bounded transfer result; it does not automatically prove cryptographic content identity, desired ownership/mode or downstream consumer usability. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |