Symbolic vs numeric permissions
Unix permissions are three groups of three bits: owner, group, others. Each group has read (r=4), write (w=2) and execute (x=1). The numeric mode is just each group's three bits summed: rwx→7, r-x→5, r--→4. So 754 means owner can read/write/execute, group can read/execute, and everyone else can only read.
Special bits
- setuid (4): runs with the file owner's privileges — often
4755. - setgid (2): directories inherit the group; files run with the group's privileges.
- sticky bit (1): only the owner can delete files, even in a shared dir like
/tmp(hence1777).
Common modes
644— owner write, everyone read (typical files).755— owner full, group/others read+execute (scripts, dirs).600— owner only, private (SSH keys).777— everyone everything — usually a security smell; prefer something tighter.
Under the hood
symToNum() validates the symbolic form against a strict nine-character pattern before converting anything, which is why a typo like rw-r--r-- with a missing dash is rejected instead of silently misread. Each position maps to a bit, so the three triads become three octal digits; numToSym() runs the mapping backwards and padSym() normalises shorter input to the full nine positions. The special bits are handled separately: when s, S, t or T appear, specialName() labels setuid, setgid or sticky and the octal form gains a fourth leading digit.
Formats, sizes and other limits
Only the traditional Unix mode bits are modelled. POSIX ACLs, SELinux contexts, file attributes such as immutable or append-only, and filesystem-specific behaviour are all invisible here. The symbolic and numeric forms also mean different things for directories — execute means "may enter", not "may run" — and the page does not attempt to check what a real filesystem would allow. Names are explained, not recommended: 777 is described accurately as world-writable.
Privacy: nothing is uploaded
Permission arithmetic is a handful of bitwise operations on numbers you typed. The page cannot see your filesystem and never asks it anything.
Frequently asked questions
Is 777 dangerous?
It lets any user read, write and execute — including replacing files in a web root. The page explains it because people look it up, not because it is a good default.
How do I write setuid?
Use four octal digits: the leading digit carries setuid (4), setgid (2) and sticky (1). The symbolic form shows it as s or t in the execute position.
Do directory permissions work the same way?
The bits are the same, the meanings differ: read lists names, write creates and deletes entries, execute allows traversal into the directory.