Web Development

Stop Cargo-Culting chmod 777 and Actually Understand Your Filesystem

A

Adil Sher

Author

Aug 23, 2026
4 min read
10 views
Stop Cargo-Culting chmod 777 and Actually Understand Your Filesystem

I'll be honest: for the first three years of my career, I treated chmod 777 like a magic incantation. Script won't run? Permissions broken? chmod 777, move on, ship it. I never questioned why I was doing it, just that it worked. Then I got burned in production, badly.

A junior developer on my team accidentally deleted a critical log file from a shared directory because I'd blindly applied world-writable permissions months earlier. Nobody had intended for that to happen. The permissions were so wide open that the principle of least privilege went completely out the window. That's when I realized I'd been actively sabotaging the security of systems I was supposed to be protecting, all because I couldn't be bothered to understand a core Unix concept.

The embarrassing part? Understanding chmod isn't actually that hard. It just requires looking at it the right way.

The Permission String Is Just a Sentence

When I stopped thinking of rwxr-xr-x as some cryptic number puzzle and started reading it as actual English, everything clicked. That 10-character string isn't math, it's a straightforward description of who can do what with a file.

The first character tells you the file type. Then you get three groups of three characters: one for the owner, one for the group, one for everyone else. Each group of three characters answers the same question: can they read, write, or execute? That's it.

I can look at -rw-r--r-- and immediately think: "Owner can read and write. Group can only read. Everyone else can only read." No calculation needed. It's as readable as a sentence once you stop expecting it to be confusing.

The Symbolic Method Actually Makes Sense

Here's what changed my workflow: instead of trying to memorize that 755 means "give the owner everything and everyone else read-execute," I use symbolic mode. It's literally built for humans.

chmod u+x script.sh means "add execute permission for the user who owns this file." Seven words, perfect clarity. No magic numbers, no guessing, no off-by-one errors in my head.

The formula is stupidly simple: chmod [WHO][ACTION][WHAT] filename. Who (u/g/o/a), action (+/-/=), what (r/w/x). That's your entire vocabulary. You can build any permission scenario you need with this.

Real-World Example: Where This Matters

Last month I had to set up a deployment directory where multiple developers could upload build artifacts but not delete each other's work. With numbers, I would've agonized over the right octal value. With symbolic mode, I just thought through it step by step.

chmod u=rwx logs/ # Owner gets full control
chmod g=rx logs/ # Group gets read and enter only
chmod o= logs/ # Everyone else gets nothing
chmod +t logs/ # Sticky bit so only owners can delete their own files

That sticky bit part is crucial. Even with write permissions, the sticky bit prevents users from deleting files they don't own. That's the kind of nuance that numeric chmod obscures completely.

My Take: Context Matters More Than Memorization

I agree completely with the core argument here. There's zero value in memorizing octal codes if you actually understand what you're trying to achieve. The problem is that understanding requires thinking about security intentionally, and most of us don't do that by default.

Where I'd push back slightly: knowing some common patterns is still practical. You don't need to memorize them, but when you encounter 644 on a config file or 755 on a script hundreds of times, pattern recognition saves you from reasoning through it every single time. That's not memorization, that's just experience.

The real win is never again blindly running chmod 777 because someone on Stack Overflow told you to. You'll read that suggestion, think "wait, that opens write access to literally everyone," and do something sensible instead.

Your Move

If you've been coasting on memorized numbers or blindly copying chmod commands, spend fifteen minutes understanding the three-question framework. Read your file permissions like English, not math. The next time you encounter a permission error, you'll actually know why the fix works instead of hoping it does.

What's your biggest frustration with Linux permissions? Hit me up on Twitter or drop a comment, I'd be curious if there are edge cases I'm still overthinking.


Source: This post was inspired by "Understanding chmod Without Memorizing Numbers" by Dev.to. Read the original article

Share this article

Written by Adil Sher

Full stack developer building high-traffic platforms, AI services, and custom web applications. Explore my portfolio, learn about my background, or get in touch.

Related Articles

Why I Stopped Treating Dead-Letter Queues as a Trash Bin
Web Development Oct 25

Why I Stopped Treating Dead-Letter Queues as a Trash Bin

Three months ago, I shipped a reservation expiry system that silently swallowed failures. A payment hold stayed open for days past its window because a webhook timed out, nobody logged it, and the retry logic just gave up. The customer's balance looked wrong. My manager asked wha...

When a Vulnerability Sits Hidden for Two Years, We All Have a Problem
Web Development Oct 23

When a Vulnerability Sits Hidden for Two Years, We All Have a Problem

I was debugging a memory leak in one of our microservices last month when a colleague mentioned the PHP security incident casually over coffee. "Yeah, they patched something critical," he said. I nodded and moved on. But then I actually read the details, and something clicked: th...