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; (ACL defaults: files vs directories, 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, Using setfacl to allow group members to write to any file in a directory )
Is this even feasible?
umask
to022
to get0644
file permissions, you get0755
directory permissions. If you setumask
to002
in order to get0775
directory permissions, you'll get0664
file permissions. – Andrew Henle Jun 30 '20 at 10:11rsync
's--chmod
flag, like so "--chmod=D1775,F644
". An issue withumask
is that it is user modifiable. – Darkfish Jul 01 '20 at 03:01