54 points · by chasil · 3y ago · 20 comments
The downside of lftp's mirror subsystem is that directory enumeration is slower than rsync as there is no corresponding daemon on the other end to assist with the local aspect of remote enumeration. It is just using SFTP commands to do all the work.
This is a benefit for things like mirroring http hosted file repos, as many do not offer rsync due to security or increased load of running a service. Lftp still does a good job on those.
What I have noticed reading comments online is that people who express satisfaction with or actively promote PowerShell (the name still cracks me up) are often the same people who expressly dislike using UNIX or are blissfully ignorant of the UNIX shell's existence. As such, it's possible they would not miss something like an exit status in $? because they never actually tried using it.
But if you're dealing with a multi billion dollar company that says "no", then this guide could come in handy.
This would be more difficult to do with rsync. I'd also be concerned with the account getting a shell, even if the command= option is set in authorized_keys.
In both cases the client is acessing an ssh server and relying on mere config files to ensure that the ssh server launches something other than a shell.
However rsync is also it's own service that doesn't have to use ssh at all, meaning no possible risk of getting a shell. It can be chrooted both from within and without (it can manage chroots of shares, and it can be chrooted itself). And wire encryption could be layered on some other way. ssh is merely convenient.
It is:
Match Group sftponly
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
(Open)rsync is not included in OpenSSH, and it likely never will be.There may be multiple approaches to implement the above configuration with either the older GPL or newer BSD implementation of rsync, and the capabilities between the two variants will differ, adding further complexity.
The established best practice is the above configuration, for these reasons.
All the bad stuff about ftp is not present in sftp.
The SITE command is thankfully not implemented in sftp, and the commands that traverse the wire are not ASCII, so they are indeed very different.
Sftp also left behind the ASCII/binary mangling of line endings.
I think the "ftp must die" paper reveals many of the foibles of ftp.