Suggested day 1220–30 minutesSafe in practice folder

Mission 2 of 5

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.

Outcome: Permission strings stop looking like random letters.

Mental model

Understand what is happening

r=read, w=write, x=execute.

Owner, group, and others each have permissions.

Directories need x permission to enter.

Guided lab

Work through the mission

1

Practice chmod

Safe

Changes permissions on your own practice file.

Terminal
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
2

Make a script executable

Safe

Adds execute permission to a practice script.

Terminal
echo 'echo Hello' > scripts/hello.sh
chmod +x scripts/hello.sh
./scripts/hello.sh
3

System special bits example

Explanation

These examples explain SUID and sticky bit. Do not run them; Ubuntu already manages system permissions.

Terminal
chmod u+s /usr/bin/passwd
chmod +t /tmp

Checkpoint

Verify the mission

ls -l shows the intended bits and the script runs directly.

Try it yourself

One step without a recipe

Create secret.txt and set it to 600. Create public.txt and set it to 644.

Need a hint?

When in doubt about permissions, go more restrictive, not less. `chmod 644` for files you want others to read. `chmod 600` for files that should stay private. `chmod 700` for directories you want to enter but keep closed to others. Resist the urge to use 777 — it's almost never the right answer.

Explain it back

Before you move on

  • What number represents read permission?
  • Why is chmod 777 usually a bad habit?

Shortcuts:Alt + ← previous lessonAlt + → next lessonAlt + H home? focus search