• About
  • Editorial policy
  • Contact
  • Privacy
  • Legal
  • Cookie settings
Monday, November 2, 2026
  • Login
PacketNebula
  • Home
  • News
  • Tools
    • Network
    • Security
    • Developer
    • Sysadmin
    • SEO
    • Email & DNS
  • Guides
  • Trackers
    • LLM API pricing
    • Open-weight models
    • Retirements calendar
    • Infrastructure deals
  • About
  • Download
No Result
View All Result
PacketNebula
No Result
View All Result
Home Sysadmin

How to change file permissions with chmod

by Stéphane Cardon
7 October 2026
in Sysadmin
0
Overhead illuminated sign reading Authorized personnel only in German, English and Spanish, above a closed door

Image: Marek Ślusarczyk (Tupungato) / Wikimedia Commons, CC BY 3.0

Share on FacebookShare on Twitter

So the script won't run, or a web folder throws a 403 you can't explain. That's permissions, and the fix is usually chmod 644 for a plain file or chmod 755 for anything that needs to run, folders included. When one file just has to become executable, chmod +x does it. Nothing cleverer. The three digits aren't magic either: owner, then group, then everyone else, and inside each digit you add read (4), write (2), execute (1). Once that clicks you stop looking it up. We'll walk the numbers and the symbolic shortcut for quick one-off flips, plus the recursive -R that fixes a whole tree right up until it stamps execute where it shouldn't. We leave 777 out of it, because it's almost never the real fix.

The short answer

chmod 644 file for a normal file. chmod 755 dir for a folder or a script, and chmod +x script.sh when one file needs to become runnable. Add -R to push a mode down a whole tree. The three digits: owner, group, others.

644files: owner writes, others read
755folders and scripts: add execute
+xmake one file runnable
Answer card showing chmod 644 for files, 755 for folders and scripts, +x to make runnable, and -R for recursive.
The two numbers you use daily, plus the symbolic shortcut.

Read the three digits, and why folders need execute

Each digit covers one set of people: owner first, then group, then everyone else. Inside a digit you add up read (4), write (2) and execute (1). So 6 is read plus write and 5 is read plus execute. 7 is the lot. chmod 644 lets the owner edit and leaves the rest read only, exactly what we want on a plain file nobody should be running. Run ls -l afterwards and the permission string on the left says the same thing back.

Linux
chmod 644 notes.txt

Here’s the bit that catches people: a folder needs the execute bit too. Not to be “run”, to be entered at all. So a folder and a script both want 755, where the owner can change things and everyone else can read and run them. Get this wrong on a web directory and you’ll stare at a 403 that has nothing to do with your config. We’ve lost real time to that one.

Linux
chmod 755 deploy.sh

The quick symbolic change

Recomputing all three digits just to flip one bit is a waste. The symbolic form says only what changes: +x adds execute, -w removes write. Aim it with u for the owner, g for the group, o for others. I reach for this far more than the numeric form in day-to-day work.

Linux
chmod +x backup.sh
Terminal showing ls -l before and after chmod +x, with the execute bit appearing in the permission string.
ls -l before and after: the x is the execute bit you just set.

Apply it down a tree, carefully

-R walks into every file and subfolder. Right tool for fixing a whole tree at once, but blunt: chmod -R 755 also stamps the execute bit onto every plain file, which is messy and, on anything public, a small security smell. When folders and files need different modes, set them separately (find is the usual way) instead of blanket-applying one number.

Linux
chmod -R 755 site/

If you’d rather click than count, the chmod calculator turns checkboxes into the exact number and back.

The recursive case deserves its own warning, because chmod -R 755 on a project is a mistake people make once and then remember forever. It marks every file executable, including your images and your configuration, which is both wrong and a security smell in a web root.

What you almost always want is 755 on directories and 644 on files. There’s a neat way to say that in one command, using a capital X, which means "execute, but only where it already applies or where it’s a directory".

Linux and macOS
chmod -R a+rX,u+w,go-w .

The explicit version with find is longer and clearer, and it’s the one we reach for on anything we care about: find . -type d -exec chmod 755 {} + then find . -type f -exec chmod 644 {} +. Two commands, no surprises.

Octal is quicker once you’ve memorised 755 and 644. It’s quicker than translating symbols in your head, and you’ll recognise 755 and 644 on sight inside a week. The symbolic form earns its place for a quick +x on one file, and not much else.

Frequently asked questions

What does chmod 755 actually mean?

Three digits, one per group: owner, group, others. Each digit adds read (4), write (2) and execute (1). So 7 is 4+2+1 (read, write, execute) for the owner, and 5 is 4+1 (read and execute) for the group and for everyone else. It's the standard mode for folders, and for scripts other people need to run.

When do I need chmod +x?

When a file should be runnable as a program. A shell script, say, or a downloaded binary. Hooks too. Without the execute bit the system flat out refuses, even if the contents are fine. "chmod +x script.sh" sets it, and "ls -l" confirms it: an executable shows an x in the permission column.

How do I apply a permission to a whole folder?

Add -R for recursive: "chmod -R 755 mydir". Careful though, it hits every file and subfolder on the way down. The usual refinement is folders at 755 and files at 644, set separately with find, because plain files rarely need the execute bit.

Is chmod 777 a good idea?

Almost never. 777 lets anyone read, write and run the file. That's a security hole, and usually a sign someone's guessing at a permission problem rather than fixing it. If something won't work, find the right owner with chown or the right mode (often 644 or 755) instead of opening it to everyone.

Tags: chmodcliguidelinuxpermissions
ShareTweet
Previous Post

GLM-5.2 vs GPT-5.5 and Opus 4.8: benchmarks and price

Next Post

How to show your IP address from the command line

Stéphane Cardon

Stéphane Cardon

Network cybersecurity engineer: architecture, LAN and WLAN, system administration. He runs PacketNebula, where he publishes the tools and answers he wanted for his own work.

Next Post
ELECOM WRC-300FEBK Wi-Fi router with WAN and LAN port labels on top, lying next to its power adapter

How to show your IP address from the command line

Free tools

  • IPv4 subnet calculator
  • DNS lookup
  • SSL certificate checker
  • HTTP headers checker
  • SPF, DKIM and DMARC checker
  • JWT decoder
  • Cron expression builder
  • Chmod calculator
  • Password generator

All 24 tools →

Guides to keep handy

  • Flush the DNS cache on Windows
  • Kill the process using a port
  • Generate an SSH key
  • Secure a new Ubuntu VPS
  • Find files on Linux
  • Extract and create tar.gz

More guides →

Who writes this

Stéphane Cardon, network cybersecurity engineer. Architecture, LAN and WLAN, system administration. PacketNebula holds the tools and answers he wanted for his own work.

About this site →

  • About
  • Editorial policy
  • Contact
  • Privacy
  • Legal
  • Cookie settings

Copyright © 2026 Stephane Cardon.

No Result
View All Result
  • Home
  • News
  • Tools
    • Network
    • Security
    • Developer
    • Sysadmin
    • SEO
    • Email & DNS
  • Guides
  • Trackers
    • LLM API pricing
    • Open-weight models
    • Retirements calendar
    • Infrastructure deals
  • About
  • Download

Copyright © 2026 Stephane Cardon.

Cookies, your call

We use Google Analytics to see which pages get read. Once our AdSense application is approved, articles and guides will carry Google ads. Nothing runs until you say yes, and nothing runs on the tool pages. Details