Chapter 13 · Simulation

Permissions Lab

← Chapter 13
Role
Modes
Speed 2/s
chmod 644 file.txt

Mode 0644 Class – Needed – Result – Step 0/0

Permissions Lab

How does a Unix kernel decide whether a user may read, write or execute a file or directory? The access check based on the permission bits (rwx for owner, group and others, plus setuid, setgid and sticky) and the first-match rule is shown step by step on a flowchart.

Usage

  • Choose the object type (File / Directory) and the operation; the Role buttons fill the user field with the owner, a group member or an unrelated user.
  • The owner, the file’s group, the requesting user and the user’s groups (comma-separated) can be edited directly.
  • Toggle the bits in the grid, type an octal mode, or pick a preset Modes value. Every change replays the check; use the playback buttons to follow it step by step.
  • umask opens the umask calculator (permissions of new files and directories; Apply loads the result into the grid). Matrix shows what each class can do.

Rules

First match
Is the user the owner? The owner bits are used. If not, is the user in the group? The group bits. Otherwise the others’ bits.
r w x
4 + 2 + 1 in each class’s digit.
Directory r
List the names.
Directory w
Create, delete, rename entries; needs both w and x.
Directory x
Search / traverse (cd, access files by name).
setuid
4xxx: the program runs with the owner’s identity (s/S in the owner’s x position).
setgid
2xxx: the program runs with the group’s identity; directories pass their group on to new entries.
sticky
1xxx: in a directory each user can delete only their own files (t/T).
umask
Bits cleared from 666 / 777 (masking, not subtraction).
Scope
Ordinary users only: no root, ACLs or parent-directory path checks.

Legend

class in use required bit is set required bit is missing ✓ allowed✗ denied

Keys

←→ stepSpace replayHomeEnd first / lastEsc close