Search code examples
filedirectoryfreebsdrights

FreeBsd: Allow users of the same group have automatic read/write access to files and directories created by them


In our FreeBSD-environment where we have one server that acts as a file-server, we have a problem that our system administrator says can not be fixed.

All our files resides in a directory and we all have access to that directory, its sub-directories and files. The problem is that once a user in our group creates a file or directory, we have to chmod that directory or file to change the rights so that others in our group can access, read, write and delete. These are not files or sub-directories inside our home-directories, but in a directory where we are supposed to work with them on a daily basis.

Finding it difficult to believe that there is no good solution, I would request that someone assist me with a solution.


Solution

  • I think what you want is a setgid bit on the directories and umask. Then newly created there files and directories will have proper group and proper permissions to let others read abd write them.

    find /your-files-are-rooted-here -type d -print0 | xargs -0 chmod ug+rw,g+s

    and set umask to 002 (or whatever is appropriate). And, of course, you may want to fix permissions for existing files (the command above only takes care of directories).