Set group permissions for whole subdirectory with ACLs

screenshot of terminal showing output of getfacl command on a file

Sometimes you want to preserve file permissions under subdirectories in linux with ACLs but that’s not the whole story. If you want multiple users to be able to read and write to these files, and the group permissions to stay correct, you need to set ACLs and also group +s on the subdirectories. This is to ensure new files and directories are also created with the correct permissions and group ownership.
I wrote a small script that takes a group and a directory as parameters, and recursively fixes the permissions and set new ACL and group permissions so in future, new files will have the correct permissions.
I put set-acl-permissions on github.
It blindly recursively sets permissions so be careful. Also, it may well contain bugs that could cause catastrophic failures.

Leave a comment

Your email address will not be published. Required fields are marked *