Users, groups and file modes
Quick answer
Linux uses numeric user and group IDs to decide which permission class applies to a process. Start by inspecting your identity and the ownership of a file, rather than assuming every user has the same access.
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
In -rw-r-----, the first character is the type (regular file); the next three bits are owner permissions, then group, then others. The owner class is selected when the effective filesystem identity matches the owner; otherwise matching group membership selects group, otherwise others. These basic classes are not added together. Extended ACLs and privileged capabilities can change the decision. id shows effective identity and supplementary groups; GNU stat can show numeric ownership and mode without parsing ls output. Names are resolved from account databases; numeric IDs are stored in file metadata.
Imagine a file with mode 0040: its owner has no ordinary access bits, but its group has read permission. If the owner also belongs to that group, the owner does not fall back to the group bits. First determine which class applies, then examine that class. This example assumes ordinary discretionary access checks without overriding privilege or an extended ACL.
Try the examples
The fixture must be run without root privileges.
Expected stdout:
ordinary-userOwner can read and write, group can read, others have no access.
Expected stdout:
-rw-r----- 640test "$(stat -c %u report.txt)" = "$(id -u)" && printf "%s\n" owner-matchIDs match because setup creates the file as your user.
Expected stdout:
owner-matchCommon mistakes
Do not assume group permissions are added to owner permissions. A displayed mode is not proof of actual access: parent directories, ACLs and security policy matter.
Practice
Inspect report.txt with ls -l and stat; describe its three permission classes and compare owner ID with id -u.
Related references
Study: id, ls. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Users, groups and file modes — Knowledge Check
Apply the lesson concepts to the controlled permission fixture.
What does the first character in -rw-r----- mean?
What does id -u report by default?
Which class applies when the basic mode check matches the owner?
What can also affect access?