What is 755 Permission in Linux: Explained Simply
755 permission means the owner can read, write, and execute, while others can only read and execute. It is commonly used to allow everyone to run a file or access a directory but only the owner can modify it.How It Works
Linux permissions control who can read, write, or run files and folders. The number 755 is a shortcut to set these permissions using three digits. Each digit represents permissions for the owner, the group, and others.
Think of it like a house with three types of visitors: the owner, family members (group), and guests (others). The owner has full access (read, write, execute), family and guests can enter and look around (read and execute) but cannot change anything (no write).
The digits come from adding numbers for each permission: read = 4, write = 2, execute = 1. So, 7 means 4+2+1 (full access), and 5 means 4+0+1 (read and execute).
Example
This example shows how to set 755 permission on a script file named run.sh. It means the owner can edit and run it, others can only run it.
chmod 755 run.sh
ls -l run.shWhen to Use
Use 755 when you want to let others run or access your files or directories but not change them. For example, scripts or programs that many users need to execute but should not modify.
It is common for web server files or shared scripts where the owner manages the content, but everyone else can use it safely.
Key Points
- 7 means full access (read, write, execute) for the owner.
- 5 means read and execute for group and others.
755is safe for shared executable files.- It prevents others from modifying your files.