Set a Volume’s permissions to group write for all files and folders

hard drivepermission

To me this seems like it should be easy but I'm having a hard time finding a very good answer that seems definitive to me.

I have a I have a hard drive mounted that my wife and I share (internal drive). My wife are I both in admin group and this drive's group ownership is also admin.

This volume's current permissions are: drwxrwx---. My wife and I can both add and create files, however, these new files are not inheriting the parent volumes permissions. If I create a new folder or file, the g+w bit is not being set. It's read only.

I don't really want to change my umask from 022 to 002 because it's only this volume I want the g+w bit set. I guess I can if that's the only solution.

I want to ensure that any file created, copied, or moved to this Volume (anywhere on the volume) has the correct permissions. Is this possible?

Or do I need to fall back on umask and a cron job to reset permissions?

edit – first attempt with ACLs

Here is what I tried, as a test. It didn't carry it forward to the next file I created though. I don't think I fully understand how this is supposed to work …

$ mkdir test-acl
$ chmod 770 test-acl
$ ls -le
total 0
drwxrwx---  2 damon  admin  68 Jan 13 09:50 test-acl
$ chmod +a "admin allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit" test-acl
$ ls -le
total 0
drwxrwx---+ 2 damon  admin  68 Jan 13 09:50 test-acl
 0: group:admin allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit
$ cd test-acl
test-acl$  touch test.txt
test-acl$  ls -le
total 0
-rw-r--r--+ 1 damon  admin  0 Jan 13 09:50 test.txt
 0: group:admin inherited allow read,write,execute,delete,append,readattr,writeattr,readextattr,writeextattr,readsecurity

Best Answer

You can use the following command:

sudo chmod -R +a "group:examplegroup allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,file_inherit,directory_inherit" /path/to/folder

Note the -R which should apply recursively.

This won't work for items moved into the folder though.