Shared Directory Permissions on MacOS – How to Manage File Access

macospermission

We just got a new iMac are using the /Users/Shared directory to store media assets (pictures, audio, video) that we want accessible to all users on the machine. After copying over all the files initially, we set the desired permissions and then applied the same permissions to all directory contents recursively. This is working fine, except then whenever someone creates a new file or directory, it does not have the same permissions and we have to repeat the whole permissions process before everyone can access it.

Is there a way that we can set permissions for all new files/directories created within that directory?

Best Answer

You can't do this with traditional POSIX-style permissions, but you can with inheritable access control entries. To allow read+write access for the entire "staff" group to everything in /Users/Shared/reallyshared, you'd use:

sudo chmod -R +a "staff allow list,add_file,search,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit" /Users/Shared/reallyshared

The file_inherit,directory_inherit part means that this access control entry will automatically be added to new files & folders created inside this folder, but it doesn't automatically apply to items already there (that's why I added the -R flag to chmod -- that applies it to everything currently within the folder), and it won't be applied to items created somewhere else and then moved into this folder (I don't know of a way around this, sorry).