(old thread) [PATCH] add sftp-server option to force temp files
Jeff Gibson
jgibson at spscommerce.com
Tue May 12 07:48:07 AEST 2026
On Wed, 23 Feb 2022, Damien Miller wrote:
> On Sun, 20 Feb 2022, Nathan Wagner wrote:
>> The following patch will add a -T option to sftp-server.c that forces
>> use of a temp file for uploads to the server. It takes an argument that
>> has 'XXXXXX' added to the end and used as a template string for
>> mkstemp(3).
> IMO sftp-server is the wrong place to do this - as you probably observed
> while implementing this, the SFTP protocol is agnostic to the concept of
> uploads, instead operating more at the level of the Unix syscall level
> (i.e. exposing read/write/stat/open/close operations).
> Implementing uploads that go via a temporary file in the client seems
> much more feasible as it would be subject to these considerations.
> -d
Please don't roast me to hard. I have an honest question about this. Do OpenSSH developers feel like OpenSSH's SFTP is OK to use in enterprise environments, or is SFTP seen only as something that should be used for ad-hoc file transfers?
I ask because this kind of feature is vital to any high-volume file processing site - that is - there needs to be a way to know that the file transfer is complete before doing the next thing with the file. If everything is done by automation there is no "ok, file's done uploading" email/chat/whatever. Ideally, yes, the client would rename the file upon completion to a standard convention that we know meant it was "ready", but given the variety of sftp client software out there, and the mixed abilities of the users of that software, having clients do this process is not tenable.
In my scenario, files are uploaded to shared storage, so other mechanisms of detecting that the file transfer is complete, (inotify, logs, etc) are not available.
If you don't feel like OpenSSH's SFTP server is a good fit in this scenario, fair enough. However, if you are interested in fixing a need for many sites that allow uploading, please consider this feature.
Thank you,
Jeff
More information about the openssh-unix-dev
mailing list