DEV Community

Dan Higgins
Dan Higgins

Posted on

2

Day 4: Permission Please! Understanding File Permissions in RHEL 9

Alright Linux padawan, you’ve wandered the file system, created some text-based masterpieces (pizza.txt, anyone?), and deleted files like a keyboard ninja.

But now it’s time for the question that every beginner eventually stumbles across:

"Why won’t Linux let me touch this file?!"

Welcome to the world of file permissions — the part of Linux where the system politely (or sometimes aggressively) tells you:

“You shall not pass.”

Let’s decode the mystery.

📚 Table of Contents

First, Let’s Take a Peek

Use the mighty ls command with the -l flag to see file permissions in action

You’ll get something like this:

Image description

Looks like a glitch in the Matrix, right? Let’s break it down.

What Those Weird Letters Mean

Take the first 10 characters:
-rw-r--r--

That’s Linux-speak for “who’s allowed to do what.”

  • The first character (-) tells you the file type. A - means a file, a d means directory.
  • The next 9 characters are split into 3 groups of 3:

Group Meaning
rw- Owner (you)
r-- Group (your team)
r-- Others (the world)

Each group uses:

  • r for read
  • w for write
  • x for execute

So rw- means: you can read and write, but not execute.
r-- means: they can only read.
And the last r--? Same deal, but for everyone else.

Who Owns This File Anyway?

Run ls -l shopping_list.txt

You'll see:

Image description

That second root? That’s the group. The first root is the owner (probably you). Think of it like:

“root owns it. root’s group can peek at it. Everyone else gets to look but not touch.”

Changing Permissions: Enter the chmod Wizard

Want to make a file executable?

Image description

Now it has permission to run. Like, actually do stuff.

Want to remove write permissions from everyone?

Image description

Linux now guards that file like it’s made of gold.

Shortcut magic:

  • u = user (owner)
  • g = group
  • o = others
  • a = all
  • + = add
  • - = remove

So chmod u+x hello.sh means: give the owner execute power.

Changing Ownership: Behold chown

Sometimes you’ll bump into files that don’t belong to you (rude, right?). You might need to take control — if you’re allowed:

Image description

Now Dan is king of the shopping list!

Your Mini Permission Mission:

  1. Create a file called secretdiary.txt
  2. Make it readable only by you
  3. Try to cat it as a different user (if you can)
  4. Add execute permissions
  5. Revoke write permissions for everyone

Image description

You’re now the bouncer of your own digital nightclub.

Why This Stuff Matters

File permissions aren’t just about control — they’re about security.

In the real world, permissions protect system files, user data, and keep servers from chaos.

If everyone could read, write, and execute everything, it’d be like giving everyone admin rights to your kitchen, bank account, and Netflix password

Learning this now saves you headaches later — and practicing these commands on real files is how it truly sticks.

Up Next (Day 5): Let’s talk about searching your system like a pro, featuring grep, the Sherlock Holmes of Linux

Until then, keep poking at permissions and remember:
If the terminal says “Permission denied,” it’s not personal — it’s just Linux doing its job

Top comments (0)

👋 Kindness is contagious

Sign in to DEV to enjoy its full potential—unlock a customized interface with dark mode, personal reading preferences, and more.

Okay