Strovent Systems
Terminal
Enterprise
Modernization
Resources
Contact
Sign in
Help
/
Terminal reference
/
SFTP and scp
Reference
SFTP and scp
Moving files over SSH with SFTP and scp: commands, sudo, chroot setups and their error messages.
Search help
SFTP
What SFTP is, how it differs from FTP, FTPS and SCP, and what the host must allow.
sftp put -r: copy a whole folder, and "Couldn't canonicalize"
Upload or download a whole folder with sftp put -r or get -r, why put -r fails with Couldn't canonicalize or path canonicalization failed, and scp -r.
Do scp and sftp use ~/.ssh/config? Host aliases, -F and -P
Yes. scp and sftp start ssh, so Host aliases, User, Port, IdentityFile and ProxyJump in ~/.ssh/config apply. Forwards, agent and RemoteCommand act differently.
SFTP with sudo: edit root-owned files with sftp -s
SFTP has no sudo command. Start the SFTP server through sudo with sftp -s and a NOPASSWD sudoers rule, or upload to your home folder and move it with sudo.
SFTP "Received message too long"
Why sftp says "Received message too long" when SSH works, what the remote shell is doing wrong, and how to fix it or work around it with scp -O.
SFTP chroot: bad ownership or modes for chroot directory
sshd closes a chroot SFTP login when any directory in the ChrootDirectory path is not root-owned or is group- or world-writable. Fix the owners and modes.
SFTP chroot user gets "Permission denied (publickey)" with the right key
sshd checks keys before the chroot, in the real home folder from the account entry. Keys copied into the chroot are never read, and a group-writable home fails.
scp "subsystem request failed on channel 0" and "scp: Connection closed"
Since OpenSSH 9.0, scp uses SFTP. A host with no sftp Subsystem line refuses it. Add the line on the server, or copy with scp -O, the legacy protocol.
Other categories
Getting started
Terminal types
SSH and Mosh
Files and printing
Scripts and auto-connect
Using the app
Subscriptions
Troubleshooting
3270 concepts
5250 terminal
IBM i sign-on, Telnet and messages
VT and xterm basics
Unix shell and tmux
SSH concepts
SSH error messages
Mosh
z/OS file transfer
z/OS: TSO, ISPF and CICS
Basics and glossary
References and resources