How to prevent a user from changing his home directory permissions

homepermissions

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?

Best Answer

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.

Related Question