What it is
Unix-like systems organize everything into a single rooted directory tree (/). Every file and directory records an owner, a group, and three permission triads (owner, group, others) for read (r=4), write (w=2), and execute (x=1). Directories require execute permission (x) to traverse into them.
Why you need it
Overly permissive config files expose API secrets to unrelated system users, while missing execute bits prevent deploy scripts and binaries from starting.
How it works
- Check where you are with pwd and inspect entries, dotfiles, and permissions with ls -la.
- Read the 10-character mode column: file type (-/d) followed by owner, group, and other rwx bits.
- Use chmod 600 (or go-rwx) on private secrets and chmod +x (or 755) on scripts.
- Verify the updated mode before running or exiting.
Inspecting and tightening file modes
$ ls -la /etc/app
-rw-r--r-- 1 app app 218 secrets.env # readable by everyone!
$ chmod 600 /etc/app/secrets.env
$ ls -la /etc/app/secrets.env
-rw------- 1 app app 218 secrets.env # owner read/write only
$ chmod +x /opt/app/deploy.sh # grant execute bitOctal 600 sets rw------- (owner read+write, zero access for group or others). Using chmod 777 to "make a permission error go away" creates a security exposure.
Practice ls -la, chmod, grep | wc, df -h, df -i, du, lsof, and ss -tulnp against five live troubleshooting missions.
Good practices and why
- Use ls -la so hidden dotfiles (.env, .ssh) and exact permission bits are never overlooked.
- Grant the narrowest permissions required: 600 for secret files, 644 for normal docs, 755 for shared scripts.
Common mistakes
- Running chmod 777 when debugging permission denied errors.
- Forgetting that removing execute (x) on a directory prevents entering it even with read (r).
Try it yourself
Open Mission 1 in the Linux CLI Lab: inspect /opt/app and /etc/app, make deploy.sh executable, lock secrets.env to 600, and read the README.
What a successful result looks like
ls -la shows -rwxr-xr-x on deploy.sh and -rw------- on secrets.env.
0 / 6000 characters · Saved on this device. Do not include passwords or private data.
Check your understanding
Answer the understanding check correctly to record exercise completion.
Related interview practice
These scenarios add constraints and follow-up questions to the concepts you just learned.
Further reading
Selected primary references · reviewed 2026-10-09. Examples are educational; use your framework’s documented integration guidance when building a deployed system.