Cyberlium

Linux › Module 3 › Lesson 4

BeginnerModule 3Lesson 4/5

Lab — Permission Challenge

Practice chmod, ls -l, and secure file sharing in a mini challenge

25 min+24 XP3 quiz
Module progress4 of 5

Opening

Bits on a page vs bits on your disk

You can recite 600, 644, and 777. This lab makes them visible. You will create files in your own home directory, flip modes, and prove with ls -l (and cat) who is supposed to read them. The 777 step is a demonstration on a throwaway file you just created — not a suggestion for real secrets, and never for /. When you finish, lock that file back down. Permission labs only touch files you create under $HOME/cyberlium-lab. No chown games on system files, no chmod -R 777 /usr "to fix npm."

1. What you are proving with three modes

chmod 600 means only the owner reads and writes: the pattern for SSH private keys, API tokens, and .env files. chmod 644 means the owner writes and everyone may read: the pattern for public notes, web HTML, or a README. chmod 777 means everyone may read, write, and execute: the pattern attackers search for with find … -perm -0002, because they can inject content that a privileged user or cron will later trust.

Your eyes must connect ls -l to the octal. -rw------- is 600. -rw-r--r-- is 644. -rwxrwxrwx is 777. If you cannot translate both ways, you will mis-set a key file and still feel safe because "I ran chmod." The lab forces the translation on files you own, where mistakes are cheap and reversible.

Directories need a separate mental model: execute on a directory is "traverse," not "run as a program." For this lab you focus on regular files first. When you mkdir under cyberlium-lab, leave directory modes sensible (755 or 700). Do not chmod 777 the directory just because a tutorial waved at it — that invites any local user to drop or delete names inside.

2. Mechanics: create, chmod, verify, restore

Create $HOME/cyberlium-lab/perm-lab if needed. Write secret-practice.txt with a non-secret phrase (never a real password). chmod 600 it, ls -l, confirm -rw-------. Then chmod 644, ls -l, confirm group/other read bits. Then chmod 777 briefly, ls -l, observe the carnival of rwx, and immediately chmod 600 again. The restore step is the security lesson — demos that leave 777 behind train the wrong muscle.

Optional: create public-notes.txt as 644 and compare side by side with ls -l. Read both with cat as yourself — you are the owner, so both work. Understanding "others" requires either another account on a machine you own or simply trusting the mode bits as the kernel's rulebook. Do not create accounts on a shared school server without admin approval just to "test."

chown is out of band for the core challenge unless you administer the box and understand useradd. Wrong chown on system files breaks packages. Stay with chmod on your files. If a command asks for sudo to chmod your own file under $HOME, stop — something else is wrong (path, immutable attribute, or you are not where you think).

3. Why 777 shows up in incidents

World-writable files and directories are persistence candy: drop a cron script fragment, rewrite a config a service reloads, or poison a shared upload directory. Defenders hunt -perm -0002 and sticky-bit exceptions on purpose. Your lab 777 file is a controlled sighting so you recognize the ls -l pattern later without practicing on /var/www.

600 is not paranoia theater for keys — it is the expected mode. sshd may refuse a private key that is group- or world-readable. Learning that in a lab with a fake file is cheaper than debugging a production login failure after you "fixed" permissions with 777.

Scope reminder: only your VM/WSL/spare machine; only files you create under $HOME/cyberlium-lab; no chmod on /, /etc, or other users' homes; no privilege escalation against shared hosts. Permissions are power — keep the blast radius inside your playground.

4. Wrong vs right: demo modes without leaving the door open

Failure mode — "I learned 777" becomes a permanent footgun. Right demos then locks down:

  • Wrong

    chmod -R 777 $HOME or chmod 777 / so "everything works." Leave the practice file at 777 overnight. chmod a real id_rsa to 644 so you can scp easier. Run the lab on a shared box and chmod files in /tmp that other students use. Or sudo chown root your notes "for safety" and lock yourself out of learning.

  • Right

    Under $HOME/cyberlium-lab only: create a throwaway file, set 600 and verify ls -l, set 644 and verify, briefly set 777 and verify, then restore 600 (or delete the file). Keep real secrets out of the lab file. Never widen /, never leave 777 on anything that matters, and never touch another user's paths.

5. Practical: the permission challenge steps

Copy the commands into your own shell. After each chmod, read ls -l before the next change. End with a locked file or a deleted throwaway. Write one line in a notes file: "777 was a demo; 600 is for secrets."

Command guide

Safe permission challenge under $HOME/cyberlium-lab

YOUR VM / WSL / spare machine only

Command — copy this

mkdir -p "$HOME/cyberlium-lab/perm-lab"
cd "$HOME/cyberlium-lab/perm-lab" || exit 1

Command — copy this

echo "practice secret — NOT a real password" > secret-practice.txt
chmod 600 secret-practice.txt
ls -l secret-practice.txt    # expect -rw-------

Command — copy this

chmod 644 secret-practice.txt
ls -l secret-practice.txt    # expect -rw-r--r--

Command — copy this

chmod 777 secret-practice.txt
ls -l secret-practice.txt    # expect -rwxrwxrwx — DEMO ONLY

Command — copy this

chmod 600 secret-practice.txt
ls -l secret-practice.txt    # locked down again

Command — copy this

echo "public note" > public-notes.txt
chmod 644 public-notes.txt
ls -l

NEVER:

Optional command

chmod -R 777 /
chmod 777 ~/.ssh/id_rsa
chmod 777 /etc

Mission: prove 600 / 644 / 777 with your eyes

1) Create secret-practice.txt under $HOME/cyberlium-lab/perm-lab. 2) Apply chmod 600, 644, then 777, running ls -l after each change. 3) Restore 600 (or delete the file). Write the three ls -l mode strings you saw. 4) One sentence: why leaving 777 on a real key file is dangerous.

Stuck? Ask Cyberlium AI Mentor

If octal and ls -l still disagree in your head, ask Cyberlium AI Mentor for a hint — not a chmod cheat sheet dump. Try: "Hint only: how do I read -rw-r--r-- as an octal, and what should I set after a 777 demo?" No spoilers; you should still run ls -l yourself.

You have now felt 600, 644, and 777 on disk and restored a safe ending state. That loop — change, verify, restore — is how professionals touch permissions without turning a fix into an incident. Next up — Quiz — Permissions — checks the translations without your terminal scrollback.

Knowledge Check

1

APPLY: After the lab, secret-practice.txt shows -rwxrwxrwx and you walk away. What should you do first?

Multiple choice

Knowledge Check

2

APPLY: You need a mode for a practice API token file only you should read or write. Best choice?

Multiple choice

Knowledge Check

3

APPLY: True or False: Practicing chmod 777 on a throwaway file in your home lab authorizes you to chmod 777 shared project directories on a company server to "unblock the team."

True or False

← Previous

Answer all 3 knowledge checks to continue. (0/3 answered)