DEV Community

SquirrelEngineering-VVV
SquirrelEngineering-VVV

Posted on

If you're new to the terminal, `chmod` numerical modes can feel like a secret code. Here is the technical breakdown.

The Permission Values:

  • 4: Read (r)
  • 2: Write (w)
  • 1: Execute (x)
  • 0: No permission (---)

Calculation Table:
| Value | Math | Permissions |
| :--- | :--- | :--- |
| 7 | 4+2+1 | rwx |
| 6 | 4+2+0 | rw- |
| 5 | 4+0+1 | r-x |
| 4 | 4+0+0 | r-- |

Applying the Modes:
The syntax follows the pattern: chmod [Owner][Group][Others] filename

  • chmod 700: Private (Owner only)
  • chmod 755: Public Read/Execute (Standard for binaries/scripts)
  • chmod 600: Highly Private (Ideal for SSH keys/config)
  • chmod 644: Public Read (Standard for documents/web files)

Pro Tip: Remember that sudo chmod only affects the ability to change permissions. It does not grant the file "root powers." To execute a file as root, use sudo ./filename.

Top comments (0)