I currently have an SFTP (actually vsftpd) server I use for regular archives. The OS is Centos 7.0. While I used to use SFTP, I still could benefit from having an NFS connection to this server (rw).

Could there be any problems in two daemons (sftp and nfs) working on the same directories?
Could this setup possibly lead to error and/or data corruption (supposing I do not try to write file with the same name simultaneously through sftp and ftp)?


File management is handled at kernel level, not user space. This means that the kernel will ensure that there is no file corruption when 2 programs try to read or write the same file at the same time, including daemon or any other application. So I would say that it depends on the filesystem that you are using, but not on the number of daemons accessing the same files/directories.

If you are concerned about race condition, you might be interested in mounting your file with the mandatory lock flag (mount -o mand) to avoid 2 applications to write simultaneously to the same file. Then, you can have a look to man 8 mount to have more information to the mount option I specified (search for mand), or man 2 mount (and search for MS_MANDLOCK).

On vsftd, you have the option lock_upload_files that might interest you. On NFS, you have the lock option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.