Sample Header Ad - 728x90

How to set different file and directory default permissions with or without ACL within a shared directory with `setgid` and `sticky bit` set?

0 votes
1 answer
945 views
I have searched over on multiple SE sites, though there doesn't seem to be an answer to this question. Using setgid bit, it allows to retain parent group and sticky bit for ownership, though this doesn't help with permissions. ACL on the other hand sets same permissions for both files and directories created within a given shared directory. Assume a shared dir (/path/to/shared) with permissions 3775 and ownership root:shared-group. How do I set default permissions on this shared dir, such that newly created files have permissions set to 644, whereas newly created directories have permissions set to 775? In a nutshell, newly created files should be group readable but directories be group writable. Using ACL with group permissions set to rwX makes even files group writable. There are answers that are similar, but not quite; (https://unix.stackexchange.com/questions/98712/acl-defaults-files-vs-directories , https://unix.stackexchange.com/questions/115631/getting-new-files-to-inherit-group-permissions-on-linux , https://stackoverflow.com/questions/580584/setting-default-permissions-for-newly-created-files-and-sub-directories-under-a , https://unix.stackexchange.com/questions/71743/using-setfacl-to-allow-group-members-to-write-to-any-file-in-a-directory ) Is this even feasible?
Asked by Darkfish (101 rep)
Jun 30, 2020, 09:45 AM
Last activity: Oct 11, 2023, 11:19 PM