Has anyone else ran into cheap hosting providers where scp would work but sftp doesn't? I hope this change will make them reconsider their configuration.
SCP is always external, and merely needs to be found in the path. Because it's much more simple to configure, greater ubiquity is not surprising.
cat foo | ssh user@remote 'cat > foo'
That is why all the escaping is necessary.SFTP is essentially RPC for the various I/O syscalls (open, read, write, ...) - it's basically NFS-as-a-user over SSH. Read/write size is limited to 32 kB per request (in OpenSSH / minimum supported size).
-s Use the SFTP protocol for transfers rather than the original scp
protocol.> A near-future release of OpenSSH will switch scp(1) from using the legacy scp/rcp protocol to using SFTP by default.
I also always remove scp because I use only rsync over ssh, which does not have the inherent bugs of scp and sftp and is also much faster.