If user smith's home directory has the following permissions:
$ ls -l /home/staff drwxr-x--- 51 smith staff 4096 Sep 18 09:08 smith/ is it possible, somehow, to prevent him to change his home directory's permission to, for example, to 755?
If user smith's home directory has the following permissions:
$ ls -l /home/staff drwxr-x--- 51 smith staff 4096 Sep 18 09:08 smith/ is it possible, somehow, to prevent him to change his home directory's permission to, for example, to 755?
One way is to use per-user groups (i.e. one group for each user) and then set the home directory permissions to root:smith, mode 0770.
Another (more hacky) way is to script this: Create a script that inspects all home directories (get them via setpwent()/getpwent()) that reside under /home (e.g. not /root) and make it either warn when there's a discrepancy or change the permissions on the spot.
I've done the latter myself in a multi-user environment in the past and worked for years like a charm.
Your wish is only possible if the OS and the filesystem in question support the ACL standard that is used by NTFS and ZFS and that is standardized by NFSv4.
So whether you are able to do what you like depends on OS and filesystem.
Traditional UNIX rules are that user ownership of a directory also permits access mode changes. With ACLs, you are able to deny the user to change ACLs on his own directory.
setfacl. How would you do that? setfacl but about the ACL standard. setfacl was a proposal from Sun and others from 1993 that was withdrawn in 1997 because it did not met the customers wishes. The ACL standard is implemented in NTFS and ZFS and the ACLs may be modified by chmod, see schillix.sourceforge.net/man/man1/chmod.1.html This reapplies the permissions every 15 seconds:
watch -n15 "chmod 0700 *" Or alternatively create a cronjob to re-apply the permissions every minute or so.