How chmod numbers work
Each file has three sets of permissions — for the owner, the file's group, and others (everyone else). Each set is a sum of three values:
| Permission | Value | Symbol | On a file | On a directory |
|---|---|---|---|---|
| Read | 4 | r | view the contents | list the names inside |
| Write | 2 | w | change the contents | create, delete and rename files inside |
| Execute | 1 | x | run it as a program | enter it and access files inside |
So 7 = 4+2+1 (rwx), 6 = 4+2 (rw-), 5 = 4+1 (r-x), 4 = read only. The three digits of 755 are owner, group, others: the owner can do everything, everyone else can read and run.
Common permission values
| Number | Symbolic | Typical use |
|---|---|---|
| 644 | rw-r--r-- | Regular files: web pages, images, config that others may read |
| 755 | rwxr-xr-x | Directories and scripts/programs |
| 600 | rw------- | Private files: SSH private keys, .env files with secrets |
| 700 | rwx------ | Private directories such as ~/.ssh |
| 640 | rw-r----- | Config readable by a service's group but not by everyone |
| 775 / 664 | rwxrwxr-x / rw-rw-r-- | Shared project folders where a team group can write |
| 1777 | rwxrwxrwt | Shared temp directories like /tmp (sticky bit) |
Avoid 777. It lets every user on the system modify or replace the file. If something only works with 777, the real fix is usually to change the file's owner or group (chown) rather than open it to everyone.
Special bits: setuid, setgid, sticky
An optional fourth leading digit sets special modes: 4 = setuid (a program runs with its owner's privileges, as passwd does), 2 = setgid (runs with the group's privileges; on a directory, new files inherit the directory's group) and 1 = sticky (in a shared directory, users can only delete their own files). In symbolic form they appear as s or t in the execute position — uppercase S/T if execute itself is not set. setuid programs are a common security risk; don't set it unless you know why.
Frequently asked questions
What does chmod 755 mean?
Owner: read, write, execute. Group and others: read and execute. It is the usual permission for directories and for scripts that others may run.
What does chmod 644 mean?
Owner: read and write. Group and others: read only. It is the standard permission for ordinary files such as HTML pages and images on a web server.
How do I change permissions for a whole folder?
Use chmod -R, but be careful: directories need execute permission while files usually shouldn’t have it. A safer pattern is find dir -type d -exec chmod 755 {} + and find dir -type f -exec chmod 644 {} +.
Does chmod work on Windows?
Windows uses a different permission system (ACLs). chmod applies to Linux, macOS and other Unix-like systems, including WSL and most web hosting.