What chmod 755 means
| Who | Digit | Letters | On a file | On a directory |
|---|---|---|---|---|
| owner | 7 |
rwx |
Can read, modify and run | Can list files, create, delete and rename files and enter it and open files |
| group | 5 |
r-x |
Can read and run | Can list files and enter it and open files |
| others | 5 |
r-x |
Can read and run | Can list files and enter it and open files |
Each digit is the sum of read (4), write (2) and execute (1). In
ls -l output it looks like this:
$ ls -l
drwxr-xr-x 2 alice staff 4096 Oct 21 10:30 example-dir
- The owner can read, write and execute.
- The group can read and execute.
- Everyone else can read and execute.
When to use 755
- Directories
- Scripts and binaries
- Web document roots
755 is the default for directories and executables on most Linux systems: a umask of 022 turns mkdir’s 777 into 755. Others can enter the directory and run the program, but only the owner can change it. For a web root, use 755 for directories and 644 for files, never 755 for everything.
755 is also the default mode for new directories, with umask 022.
Is chmod 755 safe?
Yes, for directories. Other users can read and execute it, but can’t change it. Don’t use it for files that contain secrets.
Commands
# One file or directory
chmod 755 path
# Same thing in symbolic form
chmod u=rwx,g=rx,o=rx path
# Every directory under a tree (leaves files alone)
find /path/to/dir -type d -exec chmod 755 {} +
# Check the result
stat -c '%a %A %n' path # Linux
stat -f '%Lp %Sp %N' path # macOS
Avoid chmod -R 755 on a whole tree: it gives files and directories the same mode. The
find form above changes only directories.
Compare with similar modes
| Mode | Symbolic | Difference |
|---|---|---|
775 |
rwxrwxr-x |
Gives the owner and group full access, and others read and execute |
751 |
rwxr-x--x |
Lets the owner do everything, the group read and execute, and others only execute |
750 |
rwxr-x--- |
Gives the owner full access, the group read and execute, and others nothing |
555 |
r-xr-xr-x |
Lets everyone read and execute, but nobody write |
Other chmod values
777 · 775 · 770 · 751 · 750 · 744 · 711 · 700 · 666 · 664 · 660 · 644 · 640 · 600 · 555 · 500 · 444 · 400 · 000 · 1777 · 2775 · 4755
Need a different combination? Use the Chmod Calculator.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What does chmod 755 mean?
chmod 755 sets the permissions to rwxr-xr-x. The owner can read, write and execute. The group can read and execute. Everyone else can read and execute.
Is chmod 755 safe?
Yes, for directories. Other users can read and execute it, but can’t change it. Don’t use it for files that contain secrets.