How to Calculate Unix File Permissions (chmod)
Unix file permissions control who can read, write, and execute files and directories. The chmod command sets these permissions using either symbolic notation (rwxr-xr--) or numeric notation (754). Understanding the permission system is essential for server administration, deployment, and security.
- Calculate chmod numeric values from permission strings.
- Covers permission basics.
- Covers numeric (octal) notation.
- Covers common permission settings.
- Covers using the chmod calculator.
Permission Basics
Every file has three permission sets: owner (the file's creator), group (users in the file's group), and others (everyone else). Each set has three permissions: read (r, view contents), write (w, modify contents), and execute (x, run as a program or enter as a directory). A permission string like rwxr-xr-- means: owner can read+write+execute, group can read+execute, others can read only.
Numeric (Octal) Notation
Each permission has a numeric value: read = 4, write = 2, execute = 1. Add the values for each permission set: rwx = 4+2+1 = 7, r-x = 4+0+1 = 5, r-- = 4+0+0 = 4. The full permission rwxr-xr-- becomes 754. Common values: 755 (owner full, others read+execute โ standard for directories and scripts), 644 (owner read+write, others read โ standard for files), 600 (owner read+write only โ private files).
Common Permission Settings
755 โ directories and executable scripts. Owner has full control; everyone can read and traverse. 644 โ regular files (HTML, CSS, images). Owner can edit; everyone can read. 600 โ sensitive files (config files with passwords, private keys). Only the owner can access. 777 โ full access for everyone. Almost never appropriate โ a major security risk on production servers.
background-size animation or @property registered custom properties instead.Using the Chmod Calculator
The Chmod Calculator converts between symbolic and numeric notation in both directions. Click checkboxes for each permission (read, write, execute) for each role (owner, group, others) and see the numeric value update in real time. Or enter a numeric value and see the corresponding permission string. The tool also shows the chmod command you'd run on the server.