In Linux, chmod 755 is a shorthand way to set specific permissions using Numeric (Octal) Notation. Each digit represents a different category of user:
- 7 (First digit): Permissions for the Owner (User).
- 5 (Second digit): Permissions for the Group.
- 5 (Third digit): Permissions for Others (everyone else).
How the numbers are calculated
Each number is a sum of three basic permission values:
- 4 = Read (
r) - 2 = Write (
w) - 1 = Execute (
x) - 0 = No permission
Breaking down "755":
- 7 (4+2+1): The Owner can Read, Write, and Execute. (Full control)
- 5 (4+0+1): The Group can Read and Execute, but cannot Write (cannot edit or delete).
- 5 (4+0+1): Others can Read and Execute, but cannot Write.
What does this look like in ls -l?
If you apply chmod 755 to a file, the permission string will look like this:
-rwxr-xr-x
When is it used?
- For Directories:
755is the standard permission. It allows the owner to manage files inside, while allowing everyone else to enter the directory and see the files. - For Scripts: It is commonly used for scripts (like a
.shfile) that you want everyone to be able to run, but only you to be able to edit.
Quick Tip: If you wanted a file to be private so only you could see it, you would use chmod 700!