CSE Roadmap

Core tier · about 3 hours · 7 parts

Part 1 of 7 · 1 min read

Why this page comes second

In this module you will

  • Read a mode such as -rwxr-x--- and write it in octal, and the reverse.
  • Apply the Unix rule that only one class (owner, group or other) decides each access.
  • Compute the mode of a new file from a requested mode and a umask.
  • Say what read, write and execute mean on a directory, and what the sticky bit does.
  • Explain setuid, the real and effective user ID, and how no_new_privs limits it.

Page 1 gave the model: subjects, objects, rights, and ACLs by column. This page shows the form that Unix gives it. The inode of Level 9, page 2 already holds an owner, a group and a mode. Here the mode gets its meaning, and the kernel's check is shown at work. The page ends with the one mechanism by which a process may change its domain, which is the sharpest edge of Unix protection.

About this example About this example

Real: The two C programs of sections 2 and 4 were compiled with gcc -Wall -Wextra and run as root on a Linux test machine (kernel 6.18). The child process in the first program really changed to the other user ID with setuid before it asked the kernel with access. The stat, ls and setpriv outputs are from the same machine.

Scripted: The user IDs 1000 and 2000, the modes 0407 and 0640, and the files f407 and f640 were chosen to show the one-class rule. They are not users of the machine.

Not real: The rule in the program leaves out the root user, the capabilities of page 4, ACLs added with setfacl, and file attributes such as immutable. A real check by the kernel includes all of these.