CyberStars

chmod: Numeric Mode

Instead of letters, you can set permissions with a three-digit octal number. Each digit represents one group (user, group, others) and is the sum of:

PermissionValue
Read (r)4
Write (w)2
Execute (x)1
None0

Common permission numbers

NumberMeaningString
755owner: rwx, group: r-x, others: r-x-rwxr-xr-x
644owner: rw-, group: r--, others: r---rw-r--r--
700owner: rwx, group: ---, others: ----rwx------
600owner: rw-, group: ---, others: ----rw-------

Using chmod with numbers

chmod 755 script.sh
chmod 644 readme.txt

The numeric form sets all permissions at once: there is no "add" or "remove", you replace the entire set.

When to use which form?

  • Symbolic (u+x): when you want to change one thing without affecting the rest.
  • Numeric (755): when you know exactly what the final permissions should be.

Mission: Lock Down the Thruster Script

engine_control.sh fires the main thruster and ships with readme.txt. Station security sets each file's access in a single step, all three groups at once:

  • engine_control.sh: the owner can do everything, the group can read and run it, others get nothing.
  • readme.txt: the owner can read and change it, the group can only read it, others get nothing.

Then move both into a new engine-bay folder.

Expected result

Both files sit in engine-bay with exactly the access above.