Learn how to change Unix file and directory permissions quickly and safely with practical commands. 17.11.2025 | reading time: 2 min Permissions decide who can read, write or execute a file; `chmod` is the tool that changes them, and knowing it avoids costly mistakes. Try this: make a script executable Create a small script and follow these commands exactly to see `chmod` at work: ```bash $ echo -e "#!/bin/sh\necho Hello" > script.sh $ ls -l script.sh -rw-r--r-- 1 user group 20 Jun 01 12:00 script.sh $ chmod +x script.sh $ ls -l script.sh -rwxr-xr-x 1 user group 20 Jun 01 12:00 script.sh $ ./script.sh Hello ``` Switch between symbolic and numeric modes Use symbolic changes for quick adjustments: `chmod u+rwx,g+rx,o-rw file` and numeric when you want exact bits: `chmod 754 file` sets owner to 7 (rwx), group to 5 (r-x) and others to 4 (r--). Do it for directories and special bits Add `-R` to apply recursively: `chmod -R 755 webdir` makes directories traversable; use `chmod g+s folder` to set the setgid bit so new files inherit the directory group, and setuid/setgid/sticky are the 4000/2000/1000 bits in four-digit numeric modes. Common pitfalls and handy flags Avoid `chmod -R a+rw` on the wrong path; it can expose sensitive files. Prefer `X` (capital X) to add execute only to directories or already-executable files, for example `chmod -R u+rwX project`. Remember `chmod` does not change ownership; use `chown` for that. Tools that complement chmod Check effective permissions with `ls -l` and `stat`, manage ACLs with `getfacl` and `setfacl`, and control default bits with `umask` when creating files. Where to go next Practice on safe directories, combine `chmod` with `find` for targeted changes, and learn ACLs for complex setups; deepen that knowledge with official certifications such as CompTIA Linux+ or LPIC-1 and intensive exam preparation at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. filesystem security utilities scripting troubleshooting