Special bits and ACLs
Quick answer
Special permission bits address shared directories and controlled execution. Access control lists (ACLs) can express permissions for named users and groups beyond the basic three classes.
Prepare the practice environment
Use the chapter fixture described in lab-fixtures/permissions/README.md. Run setup as a normal user in a disposable Linux environment, enter the printed directory, check pwd, and run export LC_ALL=C; umask 022. Every example assumes a fresh fixture. Commands omit the terminal prompt; outputs below are not commands.
How it works
The leading octal digit represents setuid=4, setgid=2 and sticky=1. For an eligible executable, setuid/setgid can change effective IDs on execution; Linux ignores these bits on scripts and other restrictions such as nosuid may apply. Never set them on a lab executable. On a directory setgid normally makes new entries inherit its group; new subdirectories inherit setgid. Sticky restricts deletion/rename in a shared writable directory to eligible owners or privileged processes. ACL access entries include owner, named users, owning group, named groups, mask and others. The mask limits effective permissions of named users and group-class entries, not owner or others. A default ACL on a directory affects new entries. ls -l may show + for an extended ACL. ACL tools and filesystem support must be present.
In a directory with setgid, group inheritance does not mean every new file is group-writable; the requested mode, creation mask or default ACL still matter. In the illustrative ACL user:reviewer:rw- with mask::r--, the named reviewer can effectively read but not write, provided that entry is selected. If reviewer is the file owner, the owner entry is selected instead. Inspect both the entry and the mask; do not broaden the mask blindly because it can affect multiple entries.
Try the examples
chmod g+s roommkdir room/childstat -c %a roomstat -c %a room/childThe controlled lab shell uses umask 022. Both directories have setgid; the child has the inherited group.
Expected stdout:
27002755Uppercase T means sticky is set while other execute is absent. This tests the bit, not multi-user deletion.
Expected stdout:
1700 drwx-----Tsetfacl -m "u:$(id -u):r--,m::---" report.txtgetfacl -c -- report.txtOptional manual demonstration only. The named-user entry is limited by the mask; the owner entry still determines access for the owner. Look for a named entry with effective --- and mask::---. Use a fresh fixture; ACL support is required.
Optional manual example; not executed locally.
Common mistakes
An ACL mask is not the same as umask. Avoid adding setuid/setgid to executables or broad shared-directory permissions. A one-user lab does not prove multi-user sticky behavior.
Practice
Interpret the illustrative ACL entries user::rw-, user:reviewer:rw-, group::r--, mask::r--, other::---. What effective permissions does the named reviewer have? Answer: r--, assuming the named-user match applies.
Related references
Study: chmod, getfacl, setfacl. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Special bits and ACLs — Knowledge Check
Apply the lesson concepts to the controlled permission fixture.
What does directory setgid normally affect?
What does sticky on a shared writable directory restrict?
Which ACL entries does the mask limit?
What does uppercase T indicate?