Pcornel
Linux · SSH

SCP

Cheat sheet · https://pcornel.dk/topic.php?topic=2805

Back to the Topic

Answer

scp copies files over SSH (scp file user@host:/path). Newer OpenSSH versions use the SFTP protocol underneath.

Remember

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.

First checks

  • ssh -v user@host — client-side connection and authentication steps
  • journalctl -u ssh -u sshd -e — server log
  • sshd -T — effective server settings
  • ss -ltnp | grep :22 — sshd listening

Verify in this order

ssh connection → authenticated → file stream over the SSH channel → written on the target

Where it usually breaks

First mismatch in link/interface → address/namespace → route/neighbor → firewall/policy → socket/daemon → DNS/TLS/SSH/application peer path; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2805

Confirmation

Confirm action

Continue?