Strovent SystemsSign in
Reference

SFTP and scp

Moving files over SSH with SFTP and scp: commands, sudo, chroot setups and their error messages.

SFTPWhat 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 -PYes. 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 -sSFTP 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 directorysshd 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 keysshd 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