Chmod Calculator
Calculate Unix/Linux file permissions and get chmod command.
| Entity | Read (r) | Write (w) | Execute (x) | Octal | Symbolic |
|---|---|---|---|---|---|
| Owner (u) | 6 | rw- | |||
| Group (g) | 4 | r-- | |||
| Others (o) | 4 | r-- |
chmod 644 filenameUnderstanding Unix file permissions
Every file and directory on a Unix or Linux system has three permission sets — for the owner, the group, and all other users. Each set has three bits: read, write, and execute. The chmod command changes these permissions. Getting permissions right is critical for both security and functionality.
How to read the symbolic notation
When you run ls -l, the first column shows permissions like -rwxr-xr-x. The first character is the file type (- for file, d for directory). The next 9 characters are three groups of rwx: owner permissions, group permissions, and other permissions. A dash (-) means that permission is not granted.
Common permission scenarios
- 644: Standard file — owner can edit, everyone can read.
- 755: Standard directory or executable — owner has full access, others can read and traverse.
- 600: Private files like SSH keys — only the owner can read or write.
- 400: Read-only private file — owner can read, nobody else can do anything.
- 777: Full access to everyone — use only when absolutely necessary and never in production.
Frequently asked questions
- What do Unix file permissions mean?
- Unix file permissions control who can read (r=4), write (w=2), and execute (x=1) a file or directory. Permissions are set for three entities: the file owner (u), the group (g), and everyone else (o). The combined octal value is expressed as three digits, e.g., 755.
- How does octal permission notation work?
- Each digit in the octal notation represents permissions for one entity (owner, group, others) as a sum: read=4, write=2, execute=1. So rwx=7, rw-=6, r-x=5, r--=4, -wx=3, -w-=2, --x=1, ---=0. The permission 755 means owner has rwx (7), group has r-x (5), others have r-x (5).
- What is the correct permission for a web server file?
- Typically 644 (rw-r--r--) for files and 755 (rwxr-xr-x) for directories. This gives the owner read/write access, and read-only access to the web server process (which usually runs as a different user). Avoid 777 on web-accessible files — it is a security risk.
- What is 777 permission and is it safe?
- Permission 777 (rwxrwxrwx) gives everyone full read, write, and execute access. It is almost never appropriate for production files. It is a security vulnerability — any user or process on the system can modify or execute the file. Use only in controlled development environments.
- How do I apply chmod recursively?
- Use the -R flag: chmod -R 755 /path/to/directory. This applies the permission to the directory and all files and subdirectories inside it. Be careful — applying execute permission recursively to files that are not scripts can cause issues. Use find to apply different permissions to files vs. directories: find /path -type f -exec chmod 644 {} \; && find /path -type d -exec chmod 755 {} \;
Related tools
- JSON Formatter
Format, beautify, minify, and validate JSON in your browser
- QR Code Generator
Generate QR codes for URLs, text, Wi-Fi, and more. Download as PNG.
- Password Generator
Generate strong, random passwords with custom length and character sets.
- Base64 Encoder / Decoder
Encode text to Base64 or decode Base64 back to plain text.
- URL Encoder / Decoder
Encode or decode URLs and query strings with percent-encoding.