chmod 755 — what rwxr-xr-x means
755
rwxr-xr-x
The owner can read, write, and execute; the group and everyone else can read and execute but not modify.
Permission breakdown
When to use 755
- Directories. A directory needs the execute bit to be entered and traversed, so 755 is the everyday default: anyone can enter and list it, only the owner can add or remove files inside.
- Executable scripts and binaries. A shell script or compiled tool that others need to run but never edit — the owner keeps full control, everyone else gets run-and-read.
- Web server document roots. The web server user (often
www-data) must read and traverse your site files but not write to them. Directories at 755 paired with files at 644 is the standard web layout. - Shared CLI tools in locations like
/usr/local/bin, where any user on the machine should be able to run the command.
Common mistakes & gotchas
- Don't blanket a whole tree with
chmod -R 755. It marks every file executable too — including data, configs and images that should be 644. Usechmod -R a+rX(a capitalXadds execute only to directories and already-executable files), or split it:find . -type d -exec chmod 755 {} +thenfind . -type f -exec chmod 644 {} +. - Execute on a directory is not the same as execute on a file. On a file the
xbit means “run this program”; on a directory it means “you may enter and traverse it.” That's why directories need anxthat plain files don't. - 755 lets everyone read your files. Fine for public code and web assets, but never for secrets — a config file with passwords or API keys belongs at 600 or 640, not 755.
- A non-program file rarely needs 755. If it isn't a script, a binary, or a directory, the execute bit is just noise; 644 is the right default for plain files.
755 vs the alternatives
- Use 644 (
rw-r--r--) for plain files — text, HTML, images, configs — that should be read but not run. Rule of thumb: directories and programs get 755, everything else gets 644. - 777 adds write for the group and everyone, which is almost never correct — anyone can overwrite or replace the file. If something “only works at 777,” the real fix is ownership, not permissions. 755 is the safe default that 777 is usually a lazy stand-in for.
- 750 (
rwxr-x---) removes all access for others — use it when a directory or script should be shared with a specific group (say, a deploy team) but stay invisible to everyone else on the box.
Set it with chmod
Apply this permission to a single file:
chmod 755 filename
Or apply it recursively to a directory and everything inside it:
chmod -R 755 directory/
The same thing in symbolic form:
chmod u=rwx,g=rx,o=rx filename
Frequently asked questions
What does chmod 755 mean?
chmod 755 sets permissions to rwxr-xr-x: the owner can read, write and execute; the group and others can read and execute but not modify.
Is chmod 755 safe?
Yes for directories, scripts and public web files — it grants read and execute but not write to anyone but the owner. Avoid it for files containing secrets, since others can still read them.
Should I use 755 or 644?
Use 755 for directories and for files that must run (scripts, binaries). Use 644 for plain files that only need to be read. The execute bit is the difference.
Why does a directory need 755 and not 644?
A directory needs the execute (x) bit so it can be entered and traversed. 644 has no x, so you could not cd into it or reach the files inside.
Other common permissions
Or build any permission with the interactive chmod calculator.