Linux Permissions & Chmod Basics
In Linux and Unix systems, every file and directory has a set of
access permissions that control who can read, write, or execute them. The chmod (Change
Mode) command is used to change these permissions.
Read (r)
Allows reading content of a file or listing files in a directory.
4
Write (w)
Allows modifying file content or creating/deleting files in a directory.
2
Execute (x)
Allows running a file as a program or entering a directory.
1
Common Permissions
| Value | Symbolic | Description |
|---|---|---|
| 777 | rwxrwxrwx | Everyone has full access (Insecure, use with caution). |
| 755 | rwxr-xr-x | Owner has full access, others can only read/execute (Common for web folders). |
| 644 | rw-r--r-- | Owner can read/write, others only read (Common for files/configs). |
| 600 | rw------- | Only owner can read/write (Common for keys/private docs). |
| 400 | r-------- | Read-only for owner (Strict protection). |
FAQ
What is Recursive?
The
-R flag applies the permissions to a directory and all files/folders inside it.
For example, chmod -R 755 /var/www sets everything inside to 755.
Best permissions for web server?
Directories usually need 755 (drwxr-xr-x), and files need 644
(rw-r--r--). Config files (like wp-config.php) should be stricter, like 600 or
440. Avoid 777.
What does chmod +x mean?
chmod +x script.sh makes the file executable for everyone (Owner, Group, Others).
It's commonly used to make scripts runnable.
How to restrict access to owner only?
Use 600 (rw-------) or 700 (rwx------). This ensures only the
file owner can read or write to it.
Why do directories need Execute (x)?
For a directory, the Execute permission allows you to enter it (cd command) and
access its file metadata. Without 'x', you cannot open the folder.
What is sudo chmod?
If you don't own the file (e.g., system files), you need root privileges to change its
permissions. Prepend
sudo to the command: sudo chmod 755 /etc/file.
What are Setuid and Setgid?
These are advanced permission bits. Setuid (4) allows a program to run with the privileges of
the file owner. Setgid (2) runs with the group's privileges. This calculator focuses on standard
permissions.
How is the number calculated?
It's the sum of octal values: Read=4, Write=2, Execute=1. A permission of "rwx" is 4+2+1 = 7.
"r-x" is 4+0+1 = 5. You calculate this for Owner, Group, and Public separately.
More Free Tools
Cron Generator
Visual Crontab generator with cron expression parsing.
UUID Generator
Online UUID v1 & v4 generator.
JSON Formatter
Validate, format, and minify JSON.
Base64 Encoder
Convert text and images to Base64.
Timestamp Converter
Unix timestamp conversion tool.
Password Generator
Create strong, secure passwords.