chmod 755
rwxr-xr-xSafe when used as intended
Owner can do everything; group and others can read and execute.
755 is the standard mode for directories and executable files. The owner can read, write and execute; the group and everyone else can read and execute but not change anything.
On a directory, 'execute' means permission to enter it and reach files inside, so 755 lets other users — including the web server — browse and read, while only the owner can add or delete. It's what you get for new directories under the common umask of 022.
Permission by permission
| Who | Read | Write | Execute | Digit | Means |
|---|---|---|---|---|---|
| owner | ✓ | ✓ | ✓ | 7 | read, write and execute |
| group | ✓ | — | ✓ | 5 | read and execute |
| others | ✓ | — | ✓ | 5 | read and execute |
- In
ls -l:-rwxr-xr-xfor a file,drwxr-xr-xfor a directory. - Symbolic form:
u=rwx,g=rx,o=rx - New directories get this mode when the umask is
022.
Use it for
- Directories in general, including web roots like
/var/www/html. - Scripts and binaries that other users need to run.
/usr/local/binand similar shared program directories.
Avoid it for
- Regular files that aren't programs — they don't need execute; use
644. - Anything private: other users can read it. Use
700or750. - Don't
chmod -R 755a whole tree: it makes every file executable. Set directories and files separately (see below).
Commands
chmod 755 path
set this mode on a file or directory
chmod u=rwx,g=rx,o=rx path
the same, written symbolically
find path -type d -exec chmod 755 {} +apply it to every directory in a tree, leaving the files alone
stat -c '%a %A %n' path
check the current mode on Linux (macOS: stat -f '%Lp %Sp %N' path)
Try variations
| Who | read | write | execute | Digit |
|---|---|---|---|---|
| owner | 7 | |||
| group | 5 | |||
| others | 5 |
The owner can read, write and execute; the group can read and execute; everyone else can read and execute.
chmod 755 file
chmod u=rwx,g=rx,o=rx file
Frequently asked questions
What does chmod 755 do?
It sets read, write and execute for the owner (7), and read and execute for the group (5) and for everyone else (5). In ls -l it shows as rwxr-xr-x.
755 or 644?
755 for directories and executables, 644 for ordinary files. Directories need the execute bit to be entered; ordinary files shouldn't have it.
Is 755 safe for a web server?
Yes, for directories. Nobody but the owner can write, so other users and the web server can read your site but not alter it. Pair it with 644 for files.