Thursday, September 1, 2022

[SOLVED] Set default level of access for files within a directory

Issue

I know that I can set the access level of a directory using chmod, but I need to specify a default level of access for every new file that is ever created in a directory, until the end of time.

Is there some way to accomplish this? chmod'ing every single file every time it gets generated in this directory isn't practical in a production environment, I need to make all files created in this directory default to 777.


Solution

Perhaps a little OT for StackOverflow.

Couple of options really, depending on what filesystem you've got.

Some filesystems support ACLs. http://linux.about.com/library/cmd/blcmdl1_setfacl.htm

Standard Unix won't allow you to force users to create mode 777, but you can set group setuid on a directory, such that all created files in that directory are owned by that group. If your default umask includes group write, that may do the trick.

On some filesystems, you can use inotify to detect changes and trigger a binary (like chmod).



Answered By - Sobrique
Answer Checked By - Robin (WPSolving Admin)