Pcornel
Linux · SSH

SFTP

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

Back to the Topic

Answer

SFTP is the SSH file transfer protocol, served by sshd's sftp subsystem (internal-sftp) and used by sftp, scp in newer versions, and many GUI clients. It can be chrooted for file-only users.

Remember

For file-only users use a Match block with ForceCommand internal-sftp and ChrootDirectory; the chroot directory must be owned by root and not writable by the user — give them a writable subdirectory.

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

Commands

df -h

Verify in this order

SSH session → sftp subsystem started → optional chroot → file operations

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=2806

Confirmation

Confirm action

Continue?