NOTE: This trick works only on UNIX systems, like BSD, that let a user belong to more than one group at the same time.
For example, you might work on a computer that has some proprietary files and software that three "guest" accounts shouldn't be able to use. Everyone else on the computer should have access. To do this, put the software in a directory owned by a group named something like deny. Then use chmod to deny permission to that group:
chmod 705 /usr/local/somedir#
ls -lgd /usr/local/somedirdrwx--r-x 2 root deny 512 Mar 26 12:14 /usr/local/somedir
Finally, add the guest accounts to the deny group (in the /etc/group file).
UNIX checks permissions in the order user-group-other.
The first applicable permission is the one used, even if it denies
permission rather than grant it.
In this case, none of the guest accounts are root (we hope!
They're members of the group called deny, however - so that permission
---) is checked and the group members are shut out.
Other users who aren't members of deny are checked for
"other" access (
r-x); they can get into the directory.
The same setup works for individual files (like programs). Just be careful about changing system programs that are.