UNIX File Access Control

Inodes · Permission Bits · Special Bits · Scenarios

In UNIX, every file has an inode: a small record on disk that stores ownership, timestamps, and 12 permission bits. Nine bits control read, write, and execute access for three categories (owner, group, others) and three special bits add behaviours like running a program with elevated privileges (SetUID) or protecting a shared directory from accidental deletion (Sticky). Use the builder to experiment, then test yourself with the scenario challenges.

Inode Anatomy: What Lives Inside a File Control Structure
File type
regular / dir / link …
Owner UID
e.g. 1001 (mlaquatra)
Group GID
e.g. 200 (staff)
Permission bits
12 bits → rwxr-xr--
File size
bytes on disk
Timestamps
atime / mtime / ctime
Data pointers
block addresses

The highlighted fields are directly involved in access control. When a process tries to access a file, the kernel compares the process’s UID/GID against the inode to decide whether the owner, group, or others permissions apply.

Permission Bit Builder

Click any bit to toggle it on or off. The ls -l output, octal value, and chmod command update in real time.

Special
Owner (u)
Group (g)
Others (o)
---------- 1 mlaquatra staff 4096 Mar 8 12:00 myfile.txt
Octal notation
0000
chmod command
chmod 0000 filename
Who can
No permissions set.

Examples

Read each situation and set the permission bits accordingly. Hit Check to see if you got it right, or Reveal to see the answer and the hint.

Cheatsheet

How Permission Bits Work
Owner (u)
r
4
w
2
x
1
Group (g)
r
4
w
2
x
1
Others (o)
r
4
w
2
x
1

Add the active values per group: r=4, w=2, x=1. Example: rwx = 7, r-x = 5, r-- = 4. The octal is written as [special][owner][group][others], e.g. 0755.

Common Patterns
chmod 600
rw-------
Private file. Only you read and write.
chmod 644
rw-r--r--
Standard file. You edit; everyone reads.
chmod 700
rwx------
Private executable. Only you run it.
chmod 755
rwxr-xr-x
Standard program. Everyone can run it.
chmod 750
rwxr-x---
Team executable. Group runs; world locked out.
chmod 770
rwxrwx---
Shared team directory. Owner and group: full access.
chmod 1777
rwxrwxrwt
World-writable + sticky. Like /tmp.
chmod 4755
rwsr-xr-x
SetUID program. Runs as owner. e.g. passwd.