The group ownership can be inherited by new files and folders created in your folder /path/to/parent by setting the setgid bit using
chmod g+s
like this:chmod g+s /path/to/parent
Now, all new files and folder created under /path/to/parent will have the same group assigned as is set on /path/to/parent.
POSIX file permissions are not inherited; they are given by the creating process and combined with its current umask value.However, you can use POSIX ACLs to achieve this. Set the default ACL on a directory:
setfacl -d -m u::rwX,g::rwX,o::- /path/to/parent
This will apply
setfacl
to the /path/to/parent directory, -m
odifying the -d
efault ACLs – those that will be applied to newly created items. (Uppercase X
means only directories will receive the +x
bit.)(If needed, you can add a
u:someuser:rwX
or g:someuser:rwX
– preferably a group – to the ACLs.)Note that, at least with ext3/ext4, you must mount the filesystem with the
acl
option, otherwise new ACLs cannot be set and existing ones will be ignored.
mount -o remount,acl /
Edit
/etc/fstab
to set this permanently.
ACLS is know as Advanced Cardiac Life Support, is a set of clinical interventions for the urgent treatment of cardiac arrest, stroke and other life threatening medical emergencies, and taking knowledge and skills to deploy those interventions.
ReplyDeleteIt's also Access Control Lists in the computer world. I am a Linux Administrator with Windows and Cisco certificates as well. I would not think my post would help anyone out if they were trying to keep someone alive but if you wanted to set default permissions on a folder so new files inherit the default permissions once added then I would be able to help you out.
ReplyDelete