What are file permissions?
In Linux/Unix, every file and folder has permissions that control:
Who can read it (see its contents)
Who can write to it (modify or delete it)
Who can execute it (run it as a program or script)
There are three groups for permissions:
Group (g) — users in the same group
Others (o) — everyone else
Each group has three permissions:
How does the number system work (like 777)?
Each permission has a number value — these are called octal values -->
You add up the values to get the permission number:
Example:
So when you see something like chmod 777, it means:
In short:
EVERYONE can do ANYTHING to the file!
If you do:
then:
You (user) can read/write/execute myfile
Your group can read/write/execute myfile
Any other random user on the system can also read/write/execute myfile
Why is chmod 777 dangerous?
Anyone can modify or delete the file.
If it’s a script or executable, anyone can inject malicious code.
It’s basically giving full control to everyone — like leaving your front door wide open!
That's why you should almost never set 777 permissions unless you're doing it in a controlled/test environment (and you understand the risks).
Cheatsheet for Common chmod:
Owner: all (rwx), Group/Others: read and execute (r-x)
Owner: all (rwx), Group/Others: no permissions
Owner: read/write (rw-), Group/Others: read (r--)
Owner: read/write (rw-), Group/Others: no permissions
Everyone: full permissions (rwx) — dangerous!
Permissions Visualization:
For example, 755 would look like this when you do ls -l:
Breaking that down:
rwx → owner can read/write/execute
r-x → group can read/execute
r-x → others can read/execute
Last updated