Understanding Linux File Permissions (chmod)
chmod 755 grants full read/write/execute rights (7) to the owner, and read/execute rights (5) to group members and public users.
Linux and Unix-like operating systems regulate file access using a permissions model divided across three user categories: User (Owner), Group, and Others (Public). Each category supports three distinct operations: Read (r = 4), Write (w = 2), and Execute (x = 1).
By combining these numeric values, you form a three-digit octal notation representing total permissions. For instance, chmod 755 grants full read, write, and execute permissions (4+2+1=7) to the owner, while group members and public users receive read and execute access (4+0+1=5). This visual calculator allows you to toggle checkboxes and instantly view the corresponding octal digits and symbolic string (e.g. -rwxr-xr-x) in real time.
Standard Server File Modes
- 644 (-rw-r--r--): Standard web server static files (.html, .css, images)
- 755 (-rwxr-xr-x): Public web directories and executable scripts
- 600 (-rw-------): Confidential files, private SSH keys (id_rsa), credentials
- 700 (-rwx------): Private system directories (.ssh folder, root scripts)
Symbolic Operator Commands
chmod u+x file— Add execute permission for file ownerchmod g-w file— Remove write permission from groupchmod o=r file— Set others permission to read-onlychmod a+r file— Grant read permission to all users
Frequently Asked Questions
What is the difference between 755 and 644 permissions?
Permission 644 grants read and write access to the file owner, and read-only access to everyone else, making it the industry standard for public web server files like HTML and images. Permission 755 adds execute rights for everyone, which is required for directories and executable binaries or scripts.
Why is chmod 777 dangerous in production?
Assigning 777 grants full read, write, and execute permissions to every user on the system, including anonymous or compromised service accounts. Any compromised process can overwrite, alter, or inject malicious shell code directly into the file.
How can I apply permissions recursively in the terminal?
To apply a permission set across an entire directory and all nested child files, use the recursive flag: chmod -R 755 /path/to/directory. Be cautious when applying recursive flags to avoid accidentally exposing sensitive configuration files.