[HN Gopher] Fault-Tolerant SFTP Scripting
___________________________________________________________________
Fault-Tolerant SFTP Scripting
Author : chasil
Score : 29 points
Date : 2023-01-04 19:28 UTC (3 hours ago)
(HTM) web link (www.linuxjournal.com)
(TXT) w3m dump (www.linuxjournal.com)
| ranting-moth wrote:
| For the unknowing, use rsync instead of sftp if you possibly can.
| Odds are high you can.
|
| But if you're dealing with a multi billion dollar company that
| says "no", then this guide could come in handy.
| 1vuio0pswjnm7 wrote:
| "Perhaps the PowerShell maintainers might consider retroactively
| defining $? as an integer type that reports the actual exit
| status of a completed program. This would be useful in a variety
| of scenarios."
|
| 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.
| LinuxBender wrote:
| Good scripting examples though in my opinion they left out the
| most fault tolerant option and that is using the "lftp" client
| [1] which happens to also speak SFTP and can mimic the behavior
| of rsync in a chroot sftp-only environment. One of the mirror
| sub-system options is "--loop" which can repeat the job until
| there are no differences based on the commands invoked. lftp's
| mirror subsystem can also spawn multiple TCP connections for a
| batch of files or even splitting up one large file into multiple
| streams, thus working around round-trip-time latency.
|
| 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.
|
| [1] - https://linux.die.net/man/1/lftp
| orev wrote:
| > lftp's mirror subsystem is that directory enumeration is
| slower than rsync as there is no corresponding daemon on the
| other end
|
| 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.
| blacksmith_tb wrote:
| I can second this, I have made quite a few scripts using lftp
| (and also lstftp, and ncftp), and it's been the most reliable
| option.
| Temporary_31337 wrote:
| We recently had to build an SFTP based file upload system for our
| customers, complete with generating temporary ssh keypairs etc as
| they have no other way of sharing data with us that would pass
| various security audits. If you told me 20 years ago that
| exchanging data with FTP would still be state of the art now, I'd
| probably would have changed careers. Literally billions sunk in
| tech companies and and only some incremental improvements in the
| fundamental network protocols.
| quesera wrote:
| The only things sftp and ftp have in common are three letters
| and an ability to transfer files.
|
| All the bad stuff about ftp is not present in sftp.
___________________________________________________________________
(page generated 2023-01-04 23:01 UTC)