The question that I am unable to find answer for is as follows: How do I make any newly created file in a specific directory executable, readable and writable by all users.

So I've got an NFS, one application running as a root on a server, the application produces text files in the mounted directory and another process running on Windows Server instance (which has also NFS mounted) which consumes those files. In order to consume files, the process requires those files to have read,write and execute permissions. The motivation is: how do I make all files created by root user have rwx permissions by default?

Things that I've found and tried: 1. Changing the /etc/export file where the settings of NFS reside. Unfortunately this one does not work. 2. Changing the umask for root. And as far as I know it is not possible to enable 777 permissions by using umask and you can only subtract from 666 permissions. 3. Setting a crontab that would change permissions periodically. This won't suffice as the operation that requires permissions happens only once and, without permissions, the Windows process blocks.

  • You can specify user, group and umask in /etc/fstab for the NFS mount. There is a Windows registry Hack for NFS. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Server for NFS\CurrentVersion\Mapping\KeepInheritance , which could be Set to 1.
    – Michael D.
    Aug 20, 2018 at 19:14

1 Answer 1


how do I make all files created by root user have rwx permissions by default?

I would use inotify. Something like this:

inotifywait -m $directory -e create |
    while read path action file; do
        if [[ $(stat --format %U "$file") == root ]]; then
            chmod 777 "$file"

Although I am a bit allergic to setting files to rwx for all due to security implications.

Online man page for inotifywait here.

  • I like this idea, I'm definetely going to read the manual and try to write such inotify script myself. I'll let you know if it works out. Aug 20, 2018 at 21:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .