Understanding Linux Permissions: The “chmod” Cheat Sheet You’ll Never Forget

When you first see a file in Linux, the three-letter string that starts with -rw-r--r-- can look like an alien language.
It tells the system who can read, write, or execute that file. Don’t worry – it’s just a set of rules.
In this post we’ll break those rules down into bite-sized pieces and give you a handy cheat sheet for the most common chmod commands.

1. What Are Permissions?

Every file has three sets of permissions:

SymbolMeaningExample
rReadYou can view the file’s contents.
wWriteYou can change the file.
xExecuteYou can run the file as a program.

The three sets are for:

  1. Owner – the user who created the file.
  2. Group – other users that belong to the same group.
  3. Others – everyone else.

So, -rw-r--r-- means:

  • Owner can read and write.
  • Group can only read.
  • Others can only read.

2. Numbers Behind the Letters

Linux also represents permissions with three octal digits (base-8 numbers).
Each digit is a sum of its bits:

DigitBinaryMeaning
4100Read
2010Write
1001Execute

Add them together for each set.

  • Example: rw- → 4 + 2 = 6.
  • Example: r-x → 4 + 1 = 5.

So, the string -rw-r--r-- translates to the octal number 644.

3. Using chmod

The syntax is simple:

chmod [options] MODE FILE...

a) Numeric Mode

chmod 755 myscript.sh   # Owner: rwx, Group & Others: r-x
chmod 600 secret.txt    # Only owner can read/write

Why 755?
It’s the classic “executable” permission for scripts and directories.
Owner gets full control; others get read + execute (they can run it but not change it).

b) Symbolic Mode

You can add or remove permissions with symbols:

SymbolEffect
+Add permission
Remove permission
=Set exactly
chmod g+w myfile.txt     # Give group write access
chmod o-x script.sh      # Remove execute from others
chmod u=rwx,g=rx,o=r file  # Explicitly set all three sets

c) Recursive Changes

Use -R to apply changes to a directory and everything inside it.

chmod -R 644 documents/   # All files: rw-r--r--
chmod -R +x bin/          # Add execute to every file in bin/

4. Common Mistakes & How to Avoid Them

ProblemFix
Accidentally removing your own read access (chmod 000 file)Use sudo or a second terminal session to restore it: chmod 644 file.
Setting 777 on a directory you don’t controlRemember that 777 gives everyone full rights. Use only for public directories if needed.
Forgetting the leading dash in ls -l outputThe first character indicates file type (- for regular files, d for directories). It’s not part of permissions.

5. Quick Cheat Sheet

File TypePermissionOctalSymbolic Example
Owner read/write/executerwx7u=rwx
Group read/write/executer-x5g=rx
Others read onlyr–4o=r

Typical setups

ScenarioOctalWhat it means
Normal file (owner full, others read)644Owner can edit; everyone else can view.
Executable script755Owner full, group/others can run.
Private document600Only owner can read/write.

6. Wrap-Up

Linux permissions might look intimidating at first, but they’re just a set of rules you can control with one command: chmod.
Remember:

  1. Think in three sets (owner, group, others).
  2. Convert letters to numbers by adding 4, 2, and 1.
  3. Use numeric mode for quick changes, symbolic mode for fine-grained tweaks.

With this cheat sheet on hand, you’ll be able to set the right permissions every time – no more accidental “no access” surprises!

Happy hacking, and remember: a well-set permission keeps your files safe and accessible when they’re supposed to be.

Leave a comment