Last month, a friend's side project got hacked. The attacker uploaded a PHP shell through a file upload form and executed it. The root cause? Every directory on the server was set to chmod 777 . He told me: "I kept getting permission denied errors during deployment, so I just 777'd everything." Sound familiar? Let's fix that. What chmod Actually Does chmod (change mode) controls who can read , write , and execute files on Linux. Every file has three permission sets: Owner — the user who created the file Group — users in the file's group Others — everyone else Each gets a combination of: Permission Symbol Value Meaning Read r 4 View contents Write w 2 Modify/delete Execute x 1 Run as program None - 0 No access Add the values to get each digit. So 7 = 4+2+1 (rwx) , 5 = 4+1 (r-x) , 4 = 4 (r--) . Three digits = owner, group, others. That's it. That's the whole system.…