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!

File Permissions in Linux

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. F…

Guide to Linux Laptop Battery Optimization in 2026

Beyond TLP: The Ultimate Guide to Linux Laptop Battery Optimization in 2026

For years, the standard advice for any Linux laptop user has been: “Just install TLP and forge…

How to Install VS Code on Ubuntu (24.04, 22.04 and 20.04)

How to Install VS Code on Ubuntu (24.04, 22.04 and 20.04)

Updated: May 2026 | Three methods covered | Works on all active Ubuntu LTS releases VS Code is the m…

best Linux Distro for Old Laptops

Best Linux Distro for Old Laptops in 2026 (Your Windows 10 Replacement Guide)

Updated: May 2026 | Tested on hardware with 1GB–8GB RAM | Covers laptops from 2010–2020 Windows 10 s…

How to Fix Copy Fail

How to Fix Copy Fail (CVE-2026-31431) on Ubuntu, Debian, Fedora, RHEL, AlmaLinux and Arch

How to Fix Copy Fail – Updated: May 5, 2026 Covers all major distributions with verified patch…

Copy Fail (CVE-2026-31431): The Worst Linux Security Vulnerability in Years

Copy Fail (CVE-2026-31431): The Worst Linux Security Vulnerability in Years

Published: May 2026 | Affects every major Linux distribution built since 2017 A critical Linux kerne…

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