Opening Scene:
Welcome to Linux Apartments — a building where every file is petty, dramatic, and has strong opinions about who can touch what.
📚 Table of Contents
- Meet the Cast
- Permission Types: The House Rules
- Reading the Apartment Directory (ls -l)
- Changing the Rules: chmod Chaos
- Changing Ownership: Landlord Drama (chown & chgrp)
- Common Permission Fails: Bloopers
- Permission Best Practices: Avoid Getting Evicted
- Closing Scene:
Meet the Cast
User (u): The main tenant. Pays the rent. Chooses the TV channel.
Group (g): Friends on the lease. Can enter but no throwing house parties.
Others (o): Random strangers. You definitely don't want them using your toothbrush.
Permission Types: The House Rules
Each file has a chore list:
Read (r): Look at the fridge list.
Write (w): Add your favorite snacks.
Execute (x): Use the kitchen to cook wild new dishes.
Reading The Apartment Directory (ls -l)
Run ls -l and you'll see the building gossip sheet:
Example: -rw-r--r--
First character: File (-) or directory (d).
Next three: User rights (VIP access).
Middle three: Group rights (occasional guests).
Last three: Others' rights (the neighbor’s weird cousin).
Changing The Rules: chmod chaos
Need to ban friends from touching your leftovers? Use chmod:
chmod u+x dinner.sh — Give yourself cooking privileges.
chmod g-w shared_groceries.txt — Take away group shopping privileges after that disastrous trip.
Numeric mode:
7 = Read + Write + Execute (the holy trinity)
5 = Read + Execute (can look and taste)
Example: chmod 755 script.sh — You run the kitchen, others can just taste test.
Changing Ownership: Landlord Drama (chown & chgrp)
Changing Ownership: Landlord Drama (chown & chgrp)
Someone moving out? Hand over the lease!
chown alex movie.mp4 — Alex now owns the TV.
chgrp roommates chores.doc — Share chores with new roomies.
Use sudo if you want to change ownership and you're not already in charge (power moves only).
Common Permission Fails: Bloopers
Setting 777? — You basically hosted a house party for the entire city.
Forgetting to add execute permission? — Staring helplessly at your oven wondering why it won’t turn on.
Giving too many people write access? — Waking up to find pineapple on your pizza files.
Permission Best Practices: Avoid Getting Evicted
Keep your personal files at 644.
Scripts and programs at 755.
Never, ever set sensitive stuff to 777 unless you love drama.
Closing Scene:
Linux permissions: messy, dramatic, and oddly relatable.
Handle with care — or prepare for sitcom-worthy chaos. 🎬