Chmod 511 Explained
Chmod 511: owner can read and execute, group and others can only execute. Protects source code while allowing execution.
Permission
511
r-x--x--x
chmod 511 filename
Permission Breakdown
| Role | Read (4) | Write (2) | Execute (1) | Octal | Meaning |
|---|---|---|---|---|---|
| Owner | r | - | x | 5 | read, execute |
| Group | - | - | x | 1 | execute |
| Others | - | - | x | 1 | execute |
Visual Permission Grid
Detailed Explanation
The permission 511 allows the owner to read and execute, while group and others can only execute.
Octal breakdown:
- 5 (Owner): read (4) + execute (1) = read and execute
- 1 (Group): execute (1) only
- 1 (Others): execute (1) only
In symbolic notation this is r-x--x--x. The owner can read the file and execute it. Group and others can execute the file but cannot read its contents. Nobody can modify the file.
This is useful for distributing compiled programs or scripts where you want users to be able to run the program but not view the source code. Note that for shell scripts, this only prevents reading via cat or similar tools; if a user can execute the script, the interpreter will read it on their behalf, so this is more effective for compiled binaries.
Use Case
Used for compiled binaries and proprietary executables where users should be able to run the program but not inspect or copy its contents.