Welcome to the Linux Foundation Forum!

OpenSSH 5.3 not Locking Files While Uploading



I have an SSHD server running on Redhat version 5. When uploading a file to the SFTP server, it appears that the file is not locked for edit, read or write. I am able to move, copy, delete the file while it is being uploaded. I see that the vsftpd has the option to enable a parameter "lock_upload_files" so that all uploads will proceed with a write lock on the files being uploaded. Does SFTP have a similar parameter that may work for me?


  • mfillpot
    mfillpot Posts: 2,177
    I do not see any option in sshd_config to allow record locking, however I believe that rsync has file locking. Would it be possible for you to utilize rsync over ssh to accomplish your task?
  • woboyle
    woboyle Posts: 501
    This is a "feature" of Unix/Linux systems, that you can move/delete a file opened by another process. The inode to the file does not change, unless you move it to another device/partition, so the changes are preserved. In the case of a delete, the file will not disappear until the application that opened it closes it. Copying the file is a different beast, in that the current state of the file is copied, so it may not capture all the changes made by SFTP while writing.


Upcoming Training