I want to set up a directory where all new files and directories have a certain access mask and also the directories have the sticky bit set (the t one, which restricts deletion of files inside those directories).For the first part, my understanding is that I need to set the default ACL for the parent directory. However, new directories do not inherit the t bit from the parent. Hence, non-owners can delete files in the subdirectories. Can I fix that?
Set sticky bit by default for new directories via ACL?
linux;permissions;acl
This is a configuration that allows members of a group, acltest, to createand modify group files while disallowing the deletion and renaming of filesexcept by their owner and others, nothing. Using the username, lev andassuming umask of 022:groupadd acltestusermod -a -G acltest levLog out of the root account and the lev account. Log in and become root or use sudo:mkdir /tmp/acltestchown root:acltest /tmp/acltestchmod 0770 /tmp/acltestchmod g+s /tmp/acltestchmod +t /tmp/acltestsetfacl -d -m g:acltest:7 /tmp/acltestsetfacl -m g:acltest:7 /tmp/acltestACL cannot set the sticky bit, and the sticky bit is not copied to subdirectories. But, you might use inotify or similar software to detect changes in the file system, such as new directories, and then react accordingly.For example, in Debian:apt-get install inotify-toolsThen make a script for inotify, like /usr/local/sbin/set_sticky.sh.#!/usr/bin/env bashinotifywait -m -r -e create /tmp/acltest |while read path event file; do    case $event in        *ISDIR*)            chmod +t $path$file            ;;    esacdoneGive it execute permission for root: chmod 0700 /usr/local/sbin/set_sticky.sh. Then run it at boot time from, say, /etc/rc.local or whichever RC file is appropriate:/usr/local/sbin/set_sticky.sh &Of course, in this example, /tmp/acltest should disappear on reboot. Otherwise, this should work like a charm.