I've got a Debian Linux-based server that accepts file uploads via scp, and this server tends to get powered off suddenly from time to time. If the power loss occurs shortly after an scp upload has completed, this can result in the uploaded file(s) showing up truncated (or missing) the next time power is restored.
Is there a way to force sshd (or whatever process is writing the uploaded data to disk... I think it is sshd) to call fsync() when the upload is complete, in order to minimize the chance of data loss due to a power outage?
As an example of the kind of thing I'm looking for, this server also accepts file uploads via Samba/CIFS, and I found that adding the following lines to the [globals] section of my smb.conf helps guard against data loss there:
strict sync = yes
sync always = yes
So I'm looking for something analogous, perhaps something that I could put into /etc/sshd_config ?
Thanks!