What is chmod?
chmod (change mode) is a fundamental Linux/Unix command that modifies the access permissions (read, write, execute) of files and directories. It controls who (owner, group, others) can do what with a file, forming the core of POSIX file security. Permissions appear in ls -l output as strings like -rwxr-xr-- or numerically (e.g., 755).



Why Understand chmod?
Grasping chmod is essential for both offensive and defensive security:
- High impact on security: Incorrect permissions lead to data leaks, unauthorized execution, or privilege escalation.
- Script execution: Add +x to run shell scripts safely.
- Web server hardening: Standard 644 for files, 755 for directories prevents common misconfigurations.
- Setuid/setgid risks: Special bits can turn benign binaries into escalation vectors.
- Compliance violations: Overly permissive files fail audits (e.g., world-readable secrets).
- System reliability: Too restrictive perms break applications.
Mastering chmod turns potential vulnerabilities into locked-down assets. 🔒
Common Use Cases
chmod is used daily in sysadmin and security workflows:
- Securing web roots (
chmod 644 *.php)
- Making scripts executable (
chmod +x deploy.sh)
- Fixing shared group access (
chmod 775 project/)