How permission modes work
Each permission has a value: read = 4, write = 2, execute = 1. Add them up per audience to get one octal digit (0–7). So rwx = 4+2+1 = 7, r-x = 4+1 = 5, rw- = 4+2 = 6. Three digits — owner, group, other — make a mode like 755 or 644.
An optional leading fourth digit holds the special bits: setuid (4), setgid (2), and the sticky bit (1).