The Warnet Desa’s locked cabinets: every file has three doors (owner, group, others) with r w x lights. Pick who tries, change the mode with chmod: which door…
Why it matters
"Permission denied", a script that will not run, an SSH key refused, chmod 777 "to make it work": all from misreading three classes and three bits. Once you know the kernel looks at one class only, and what x means on a folder, chmod stops being a spell.
The key idea
The kernel looks at one class only
Common mistakes
I chmod 777 to make the error go away, and opened a security hole 777 gives everyone write and run. Find the right class and bit: usually 644 for files, 755 for scripts and folders, 600 or 700 for private ones.
My folder lists with ls, but I cannot cd into it Going into a folder takes x; r only reads its names. chmod u+x folder (or g+x, o+x for the other classes).
SSH refuses my key: permissions "too open" That is ssh’s own rule (not the kernel’s): a private key the group or others can read is ignored. chmod 600 ~/.ssh/id_rsa.
I own it, but still Permission denied For the owner only the u bits count, even if g or o has that bit. Check the mode’s first digit with ls -l.
Try it in this playground
See a Permission denied Bagas reads cash.txt: his class is others (o), and its r bit is off.
Run a script after chmod u+x Without x, bash refuses with status 126.
Feel what x means on a folder cd refused though r is on, or ls refused though x is on.
Lock out the owner chmod 070 notes.txt, then Piksel reads it: its group may, its owner may not.