This reference guide summarizes our technical chat session regarding automated file permissions. You can open and edit this file directly in any text or HTML editor.
While chmod g+s (SGID) forces child elements to inherit group ownership, it cannot dynamically distinguish between file and folder permissions. To automatically make new folders rwx and new files rw- for a group, we use Default Access Control Lists (ACLs).
# 1. Fix permissions for all PRESENT files and folders recursively
setfacl -R -m g::rwX /path/to/parent_directory
# 2. Fix inheritance for all FUTURE files and folders recursively
setfacl -R -d -m g::rwX /path/to/parent_directory
-d (Default): Creates an inheritance template. It tells Linux that any future item created inside this folder must automatically inherit these rules.-m (Modify): Modifies the existing ACL profile.-R (Recursive): Ensures that any subdirectories that already exist receive this configuration template. Without -R, existing subdirectories are skipped.rwX instead of lowercase rwx?The capital X acts as a conditional execute flag:
| Target Type | Resulting Permission | Reasoning |
|---|---|---|
| Directories | rwx |
Required so the group can enter and navigate the folder. |
| Regular Files | rw- |
Prevents standard documents (text, images) from dangerously becoming executable files. |
setfacl and chmod g+s do not conflict because they govern entirely different tasks:
g+s) handles identity / ownership (Who owns the new files).setfacl) handle access control / permissions (What they can do).Applying a capital X to a folder marked with an uppercase rwS (missing execute) will automatically repair it into a fully functional lowercase rws directory.
A structured mapping of global vs. targeted inheritance configurations:
Note: The main sections above have been marked with contenteditable="true", meaning you can type edits directly onto the web page when opened in a browser before saving.