A quick reference for Linux file permissions, chmod numeric and symbolic modes, common permission sets, and when to use each one.
| Code / Syntax | Description |
|---|---|
u | Owner — The user who owns the file |
g | Group — Users in the file's group |
o | Others — Everyone else |
| Code / Syntax | Description |
|---|---|
r (4) | Read — View file contents / list directory files |
w (2) | Write — Modify file contents / create or delete files in directory |
x (1) | Execute — Run file as program / enter directory with cd |
| Code / Syntax | Description |
|---|---|
0 (---) | No permissions |
1 (--x) | Execute only |
2 (-w-) | Write only |
3 (-wx) | Write and execute |
4 (r--) | Read only |
5 (r-x) | Read and execute |
6 (rw-) | Read and write |
7 (rwx) | Read, write, and execute |
| Code / Syntax | Description |
|---|---|
644 (rw-r--r--) | Regular files (HTML, CSS, images) |
755 (rwxr-xr-x) | Executable scripts, directories |
600 (rw-------) | Private files (SSH keys, .env) |
700 (rwx------) | Private directories, scripts |
664 (rw-rw-r--) | Shared files (group can edit) |
775 (rwxrwxr-x) | Shared directories |
444 (r--r--r--) | Read-only for everyone |
000 (---------) | No access (lock down) |
| Code / Syntax | Description |
|---|---|
chmod u+x file | Add execute for owner |
chmod g-w file | Remove write from group |
chmod o+r file | Add read for others |
chmod a+r file | Add read for all (a = all) |
chmod u+rwx,g+rx file | Owner: rwx, Group: rx |
chmod u=rw,g=r,o= file | Set exact permissions |
| Code / Syntax | Description |
|---|---|
+ | Add permission |
- | Remove permission |
= | Set exact permission (removes unlisted) |
| Code / Syntax | Description |
|---|---|
4xxx / u+s (SUID) | File executes as the file owner |
2xxx / g+s (SGID) | File executes as the group owner; new files in directory inherit group |
1xxx / +t (Sticky bit) | Only file owner can delete files in directory |
| Code / Syntax | Description |
|---|---|
r | Can list files with ls |
w | Can create, rename, and delete files |
x | Can cd into the directory and access files |
| Code / Syntax | Description |
|---|---|
600 | SSH private keys (~/.ssh/id_rsa) |
600 | .env files |
644 / 755 | Web content — 644 for files, 755 for directories |
755 or 700 | Scripts — owner execute or private |
755 | Uploads directory (never 777) |
600 | Database files |
Found this cheat sheet useful? Check out our other references and tools.