Understand Linux permissions
Linux permissions control who can read, write or execute a file. Understanding them is essential for administration and a foundation for security work.
Read the rwx model
ls -l script.sh -rwxr-x--- 1 user developers 1200 script.sh
The permission triplets describe owner, group, and others. r means read, w write, and x execute.
| Symbol | Meaning for a regular file |
|---|---|
r | Read contents |
w | Modify contents |
x | Execute as a program |
Change permissions deliberately
chmod u+x script.sh chmod g-w shared.txt ls -l script.sh shared.txt
Symbolic mode is readable: u is owner, g group, and o others. Prefer the smallest permission change that accomplishes the task.
Security principle: Least privilege means granting only the access that is actually required. Avoid making files broadly writable or executable just to “make it work.”