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.

45–55 min Week 2 · Search, text, permissions, processes Ubuntu terminal
Your outcome: Permission strings stop looking like random letters.
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 folder

Changes 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 folder

Adds 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 only

These 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

  1. Create secret.txt and set it to 600.
  2. 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.

  1. What number represents read permission?
  2. Why is chmod 777 usually a bad habit?

Your practice, your pace

Loading saved progress…

Discussion

Continue the conversation about this guide. Loading comments connects to GitHub Discussions through giscus.

Open community discussions on GitHub

Check before you copy

This command needs care. Read its context, confirm the target and location, and keep a recovery path.

Copying does not run a command.