Mission 12 of 30
File Permissions Deep Dive
Make a script executable without opening access unnecessarily.
Read and change permissions on practice files while learning what system-level permission bits mean.
Practice inside
~/linux-practice. Check your setup before you begin.
Prerequisite: Find Command Mastery
.
What you’ll practice
- Decode rwx notation
- Use chmod safely
- Understand directory permissions
The mental model
- r=read, w=write, x=execute.
- Owner, group, and others each have permissions.
- Directories need x permission to enter.
Try it in your terminal
Practice chmod
Safe in practice folderChanges permissions on your own practice file.
Run from ~/linux-practice
cd ~/linux-practice
touch permissions_demo.txt
chmod 644 permissions_demo.txt
ls -l permissions_demo.txt
chmod 600 permissions_demo.txt
ls -l permissions_demo.txt Make a script executable
Safe in practice folderAdds execute permission to a practice script.
Run from ~/linux-practice
echo 'echo Hello' > scripts/hello.sh
chmod +x scripts/hello.sh
./scripts/hello.sh System special bits example
Explanation onlyThese examples explain SUID and sticky bit. Do not run them; Ubuntu already manages system permissions.
Run from do not run
chmod u+s /usr/bin/passwd
chmod +t /tmp Put it into practice
- Create secret.txt and set it to 600.
- Create public.txt and set it to 644.
Check your result
ls -l shows the intended bits and the script runs directly.
Common mistakes
- You get a 'permission denied' error and your first instinct is `chmod 777`. Don't. That gives everyone — every user, every process — read, write, and execute access. Use `chmod 644` for files or `chmod 755` for directories instead. 777 is the permission equivalent of leaving your front door open with a sign that says 'take anything.'
- You run `chmod 777 /etc/something` because a tutorial told you to. That file is owned by the system for a reason. Changing system permissions without understanding them is how you break your own machine. Keep permission experiments inside your practice folder.
Check your understanding
Explain these in your own words. If you’re unsure, revisit the examples before moving on.
- What number represents read permission?
- Why is chmod 777 usually a bad habit?
Your practice, your pace
Loading saved progress…