Skip to content

Mastering File Permissions in Linux (Without the Headache)

If you’ve ever felt a little lost staring at output like -rwxr-xr--, don’t worry—you’re not alone. File permissions in Linux might look cryptic at first, but once you understand the logic behind them, they’re actually pretty simple. And more importantly, they’re your first line of defense in keeping your system secure.

Let’s break it down together, nice and easy.

The Basics: Who Can Do What?

Linux assigns permissions to three types of people (or rather, “categories”):

  • User (u) – the file’s owner (usually you).
  • Group (g) – users who belong to the file’s group (like teammates in a project).
  • Others (o) – everyone else on the system.

And for each of those, there are three possible actions:

  • Read (r) – look inside the file (or list a directory’s contents).
  • Write (w) – change the file (or add/remove files in a directory).
  • Execute (x) – run the file as a program (or enter a directory).

Still with me? Good. Let’s see what that looks like in real life.

Reading the ls -l Secret Code

Run ls -l in a terminal, and you might see something like this:

-rwxr-xr-- 1 user group 4096 Mar 12 10:00 example.txt

That first chunk – -rwxr-xr-- – tells the whole story. Here’s how to decode it:

PartMeans
-It’s a file (d would mean directory)
rwxUser can read, write, execute
r-xGroup can read and execute (but not write)
r--Others can only read

So in plain English: the owner has full control, the group can run it but not change it, and everyone else can just look at it.

Changing File Permissions in Linux with chmod

You have two ways to tweak permissions – and both work great. Pick whichever feels more natural.

1. Symbolic Notation (Letters)

Use + to add, - to remove, and = to set exactly.

  • Make the file executable for the user:
    chmod u+x example.txt
  • Take away write permission from the group:
    chmod g-w example.txt
  • Give others read‑only access (and nothing else):
    chmod o=r example.txt

You can even combine them: chmod u+x,g-w example.txt

2. Octal Notation (Numbers)

This one feels like a secret handshake at first, but it’s super efficient. Each permission has a number:

  • Read = 4
  • Write = 2
  • Execute = 1

Add them up for each category. For example, 7 (4+2+1) means read+write+execute.
5 (4+1) means read+execute.
4 alone means read‑only.

So chmod 751 example.txt means:

  • User gets 7 → read, write, execute
  • Group gets 5 → read and execute
  • Others get 1 → execute only

Much shorter than the symbolic way, right?

Double-Check Your Work

After changing permissions, always peek at the result:

ls -l example.txt

If it shows exactly what you wanted – great. If not, no worries, just run chmod again.

Wrapping Up (and a friendly tip)

Learning Linux permissions is one of those skills that pays off every single day – whether you’re securing a server or just making sure your roommate doesn’t accidentally delete your homework. 😄

Practice with a few test files, and soon enough you’ll be reading -rwxr-xr-- like a pro.

Happy coding – and happy permission‑tweaking!

How to Harden Your Linux System

How to Harden Your Linux System in 30 Minutes (Step-by-Step)

Skill level: Intermediate | Time to complete: 30–40 minutes | Tested on: Ubuntu 24.04, Debian 12, Fe…

windows 11 vs linux

Windows 11 vs Linux in 2026 — Should You Switch?

Updated: May 2026 | Covers performance, gaming, privacy, software, and who should actually switch Wi…

Best Linux Distro for Gaming in 2026 (AMD, NVIDIA and Beginner Picks)

Best Linux Distro for Gaming in 2026 (AMD, NVIDIA and Beginner Picks)

Updated: May 2026 | Covers desktop, laptop and handheld gaming | Steam, Proton, and native titles Li…

Best Linux Distro for Developers in 2026

Best Linux Distro for Developers in 2026

Updated: May 2026 | Covers web dev, DevOps, data science, security, embedded and general purpose Ask…

How to Install Nginx on Ubuntu

How to Install Nginx on Ubuntu (26.04, 24.04 and 22.04)

Updated: May 2026 | Covers APT and official Nginx repository methods | Ubuntu 26.04 (Resolute Raccoo…

KLV-Airedale Linux

KLV-Airedale: The Void Linux Distro That Thinks Like Puppy Linux

Most Linux distributions fit neatly into one of two camps: the polished mainstream distros that hold…

Smart Home Automation Ideas for Beginners (2026)

Smart Home Automation Ideas for Beginners (2026): 10 Easy Setups That Actually Work

Private AI Knowledge Base with Local LLMs

How to Build a Private AI Knowledge Base with Local LLMs: A 2026 Step-by-Step Guide