Skip to the levels
ROOTSPIRE
DiscsFor teachers
▶ Play freeLibrary 16 discsDiscsFor teachersLog in

Every level, in the open

Linux: Zero to Root

23 worlds · 312 levels · 22 bosses

SOLUTION HIDDENTeachers see answer keys in the classroom.

▶ Play this discAll discs
All discsLinux: Zero to RootBash ScriptingGitDatabasesPython for OpsLinux Sysadmin ProNetworkingObservabilityCloud & IaCDocker & ContainersCTF ArenaSOC FieldWindows for Linux peopleKubernetesAnsibleThe Guildhall: First Week

Twenty-two worlds of real Linux, from your first command in /home to owning the machine as root, then systemd, performance, crypto and real job tickets. Kern the pixel daemon is your guide.

Guided levels show the command first. Alone levels give the goal only. Bosses and exams are timed.

Jump to a world

World 1 The ShellWorld 2 FilesWorld 3 The EditorWorld 4 Reading & searchingWorld 5 Users & permissionsWorld 6 AccountsWorld 7 Text PowerWorld 8 Bash ScriptingWorld 9 Your EnvironmentWorld 10 ProcessesWorld 11 Performance & CapacityWorld 12 System & ServicesWorld 13 Packages for RealWorld 14 systemd: ServicesWorld 15 Units, Timers & TargetsWorld 16 StorageWorld 17 Disks for RealWorld 18 LVM & RepairWorld 19 Linux NetworkingWorld 20 Crypto & IntegrityWorld 21 Security & HardeningWorld 22 Job TicketsFinal exam The Root Exam

World 1The Shell

12 levels

The starting village, where Kern wakes up with a fragmented memory and you learn to talk to the machine.

  1. 1

    Level 1: Who goes there?

    GuidedEasy

    Objective: Kern forgot who you are — ask the machine with whoami.

    A shell is a program that waits for a command, runs it and prints the answer. Type a word, press Enter, and Linux talks back.

    Commands taughtshellwhoami

    ▶ Play: Who goes there?SOLUTION HIDDEN15 XP
  2. 2

    Level 2: Look around

    GuidedEasy

    Objective: Kern hid a spare key in your home as a hidden file — find its name and tell him, with kern <name>.

    pwd prints where you stand and ls lists what's there. Names that start with a dot are hidden, and only ls -a shows them.

    Commands taughtpwdls

    ▶ Play: Look aroundSOLUTION HIDDEN14 XP
  3. 3

    Level 3: Escape hatch

    GuidedEasy

    Objective: Kern is snoring forever — run snore and stop it with Ctrl+C, then open ~/dream.txt with less and leave with q.

    Ctrl+C stops a command that runs forever, and q quits full-screen readers like man and less. Ctrl+D or exit closes the whole shell, so keep that one for later.

    Commands taughtctrl-cless

    ▶ Play: Escape hatchSOLUTION HIDDEN15 XP
  4. 4

    Level 4: Walk the tree

    GuidedEasy

    Objective: Use cd (change directory) to walk into ~/archive/2025/configs, where Kern's config lives.

    A path is an address: /home/guest/archive starts at the very top, the root /, ~ is a nickname for your home /home/guest, and a bare archive starts where you stand. cd path walks you there, and cd .. steps back up one folder.

    Commands taughtcdpaths

    ▶ Play: Walk the treeSOLUTION HIDDEN18 XP
  5. 5

    Level 5: Dear diary

    GuidedEasy

    Objective: Kern is writing his memoirs: run history, and send its output into ~/diary.txt with > (command > file).

    Add > file after any command and its output lands in that file instead of on the screen. history prints every command you've typed so far.

    Commands taughthistoryredirection

    ▶ Play: Dear diarySOLUTION HIDDEN18 XP
  6. 6

    Level 6: Read the manual

    GuidedEasy

    Objective: Read Kern's manual with hidden and tell him the secret word inside, with kern <word>.

    man <command> opens the manual of any command in the less reader: Space scrolls, /word searches, q quits. Even Kern has a page.

    Commands taughtmanhelp-flag

    ▶ Play: Read the manualSOLUTION HIDDEN16 XP
  7. 7

    Level 7: ls: the long view

    GuidedEasy

    Objective: Learn tldr ls and the ls switches -l, -h, -1 and -A in ~/lab/ls, then use one alone.

    ls has dozens of switches, and a handful do most of the work. Forgot one? tldr has the short list.

    ▶ Play: ls: the long viewSOLUTION HIDDEN10 XP
  8. 8

    Level 8: ls: sort it your way

    GuidedEasy

    Objective: Learn ls -t, -r, -S and -R in ~/lab/ls, then use one alone.

    By default ls sorts by name, but it can sort by time or size, flip the order, and look inside every folder.

    ▶ Play: ls: sort it your waySOLUTION HIDDEN10 XP
  9. 9

    Level 9: Tab, tab, tab

    AloneMedium

    Objective: Get into ~/kerns_extremely_important_backups/version_forty_two_FINAL_final — let Tab do the typing.

    Press Tab and the shell finishes names for you; if it stops, press Tab twice to see every match. Real admins almost never type a whole filename.

    Commands taughttab-completion

    ▶ Play: Tab, tab, tabSOLUTION HIDDEN20 XP
  10. 10

    Level 10: Too long, didn't read

    AloneMedium

    Objective: From Kern's tent, pop over to /var/log, then hop straight back with the 4-key cd shortcut that tldr cd knows.

    tldr <command> shows the few examples people actually need, and most commands also explain themselves with --help. When the manual is a novel, ask tldr first.

    Commands taughttldr

    ▶ Play: Too long, didn't readSOLUTION HIDDEN22 XP
  11. 11

    Level 11: What did I do yesterday?

    Alone⏱ TimedHard

    Objective: Yesterday Kern opened his vault with a secret code — dig it out of ~/.bash_history and tell him, with kern <code>.

    history lists this session, but bash also keeps every line in the file ~/.bash_history, so older sessions live on in there. Open it with less: /word searches, q quits.

    ▶ Play: What did I do yesterday?SOLUTION HIDDEN32 XP
  12. 12

    Level 12: BOSS: Seven copies

    Boss⏱ TimedHard

    Objective: Seven copies of Kern's config hide in one of the folders in ~/backups — tell Kern the full path of the newest, with kern <path>.

    Every command carries its own manual: ls --help lists its options, and man ls and tldr ls explain more. One of those options sorts files by time.

    ▶ Play: BOSS: Seven copiesSOLUTION HIDDEN40 XP

World 2Files

12 levels

The junkyard workshop where files are born, copied, moved, linked and lost, and everything vanishes at reboot.

  1. 13

    Level 13: Open the workshop

    GuidedEasy

    Objective: Kern's workshop is bare: in /tmp/workshop, make a folder crates with mkdir, and an empty inventory.txt inside it with touch.

    mkdir makes a folder (mkdir -p builds a whole path of them) and touch makes an empty file, or refreshes an old one's timestamp. In /tmp anyone may build, but it's all swept away at reboot.

    Commands taughtmkdirtouch

    ▶ Play: Open the workshopSOLUTION HIDDEN12 XP
  2. 14

    Level 14: Copy that

    GuidedEasy

    Objective: Use cp -r to back up Kern's whole spells folder into vault/, so a copy lives at vault/spells.

    cp source destination copies a file and leaves the original where it was. A folder needs cp -r (recursive), or cp refuses.

    Commands taughtcp

    ▶ Play: Copy thatSOLUTION HIDDEN15 XP
  3. 15

    Level 15: The door sign

    GuidedEasy

    Objective: The workshop door still says CLOSED — open /tmp/workshop/sign.txt in nano and change it to OPEN.

    nano is a text editor inside the terminal: nano file opens it (or starts a new one) and you just type. Ctrl+O then Enter saves, Ctrl+X quits, and the shortcut list at the bottom writes Ctrl as ^.

    Commands taughtnano

    ▶ Play: The door signSOLUTION HIDDEN16 XP
  4. 16

    Level 16: Signpost in the maze

    GuidedEasy

    Objective: Plant a signpost with ln -s: /tmp/shortcut, leading straight to /tmp/maze/north/dark/twisty/passage/treasure.

    A symbolic link is a signpost: a tiny file that points to another path, made with ln -s target linkname. ls -l shows the arrow, and if the target vanishes the sign points at nothing.

    Commands taughtsymlink

    ▶ Play: Signpost in the mazeSOLUTION HIDDEN18 XP
  5. 17

    Level 17: Move, rename, remove

    GuidedEasy

    Objective: Learn mv, mkdir -p, rm and rm -r in /tmp/drill, then use them alone.

    mv moves and renames, mkdir -p builds whole paths, and rm deletes for good. There is no trash can, so look before you delete.

    ▶ Play: Move, rename, removeSOLUTION HIDDEN10 XP
  6. 18

    Level 18: Wildcards: * ? [ ]

    GuidedEasy

    Objective: Learn the wildcards *, ? and [ ] in /tmp/drill2, then use them alone.

    Wildcards let one word stand for many file names. The shell swaps the pattern for the matching names before the command even starts.

    ▶ Play: Wildcards: * ? [ ]SOLUTION HIDDEN10 XP
  7. 19

    Level 19: The potion shuffle

    AloneMedium

    Objective: potion.tmp is finished — rename it potion.txt and put it on the shelf/, in one go if you can.

    mv moves a file to another place. Linux has no rename command: moving a file to a new name IS renaming, and mv can do both at once.

    Commands taughtmv

    ▶ Play: The potion shuffleSOLUTION HIDDEN20 XP
  8. 20

    Level 20: Attic of a thousand pixels

    AloneMedium

    Objective: Move every .jpg photo in /tmp/attic into the photos folder next to them — and nothing else.

    Wildcards let one word match many files: * means any characters, ? exactly one, [abc] one of a set. The shell swaps the pattern for the matching names before the command runs, so hidden previews what it hits.

    Commands taughtglobbingecho

    ▶ Play: Attic of a thousand pixelsSOLUTION HIDDEN25 XP
  9. 21

    Level 21: Two names, one heart

    AloneMedium

    Objective: Give /tmp/heart/heart.dat a second name, /tmp/heart/spare.dat — the very same file, not a copy and not a signpost.

    A hard link is a second name for the very same file: one inode (the file's ID number), two names, no original and no copy. ls -li shows the inode and how many names it has.

    Commands taughthardlinkinode

    ▶ Play: Two names, one heartSOLUTION HIDDEN25 XP
  10. 22

    Level 22: Crash dump cleanup

    Alone⏱ TimedHard

    Objective: Clear /tmp/yard: delete the cache folder and the crash dumps core.1 to core.9 — but core.42 is Kern's lucky dump, keep it!

    rm deletes files for good, there is no trash can, and rm -r takes a folder with everything inside. Pros preview a pattern with ls first, then delete.

    Commands taughtrm

    ▶ Play: Crash dump cleanupSOLUTION HIDDEN35 XP
  11. 23

    Level 23: Surprise inspection

    Alone⏱ TimedHard

    Objective: The inspector is coming: in /tmp/inspection build shelves/tools and shelves/parts, an empty log.txt in each, and a report.txt that says all clear.

    mkdir and touch both take several names at once, and mkdir -p builds a whole path in one go. Speed comes from fewer commands, not faster fingers.

    ▶ Play: Surprise inspectionSOLUTION HIDDEN38 XP
  12. 24

    Level 24: BOSS: Lost memories

    Boss⏱ TimedHard

    Objective: /tmp/ruins/old/memories.db was deleted; /tmp/ruins/memories.db is a broken signpost. A hard-linked twin hides in /tmp/ruins: restore it there as a real file.

    A file only truly disappears when its last name is gone, and ls -l (or ls -li, which adds the inode number) shows each file's number of names right after the mode. The broken signpost still squats on the name memories.db: rm it before a real file can move in.

    ▶ Play: BOSS: Lost memoriesSOLUTION HIDDEN60 XP

World 3The Editor

10 levels

The scriptorium of vim, the editor waiting on every server: modes, motions, search and replace, all without a mouse.

  1. 25

    Level 25: The escape hatch

    GuidedEasy

    Objective: Open ~/editor/scroll.txt in vim, then leave without saving anything.

    vim FILE opens a file in vim, the editor found on every Linux server. It starts in normal mode, where keys are commands: :q! (colon, q, bang, Enter) quits and throws away every change.

    Commands taughtvimvim-modes

    ▶ Play: The escape hatchSOLUTION HIDDEN12 XP
  2. 26

    Level 26: First words

    GuidedEasy

    Objective: Create ~/editor/diary.txt in vim with one line: Day 1

    Press i to enter insert mode and type like any editor; Esc goes back to normal mode. :wq writes the file and quits (:w only writes).

    Commands taughtvim-insert

    ▶ Play: First wordsSOLUTION HIDDEN14 XP
  3. 27

    Level 27: The contract

    GuidedEasy

    Objective: Kern's 60-line contract needs a signature: sign the last line, then add a witness line below it.

    In normal mode, h j k l move left, down, up, right; w and b jump a word forward or back; 0 and $ go to the start and end of a line; gg and G go to the first and last line. a appends after the cursor, o opens a new line below.

    Commands taughtvim-motion

    ▶ Play: The contractSOLUTION HIDDEN16 XP
  4. 28

    Level 28: Spam filter

    GuidedEasy

    Objective: Clean ~/editor/list.txt: delete the three SPAM lines and fix milkk to milk.

    x deletes the character under the cursor and dd deletes the whole line. u undoes the last change (press it again to go further back), Ctrl-R redoes.

    Commands taughtvim-edit

    ▶ Play: Spam filterSOLUTION HIDDEN16 XP
  5. 29

    Level 29: The chant

    GuidedEasy

    Objective: The ritual in ~/editor/chant.txt needs the line chant: ohm three times in a row: copy it and paste it twice.

    yy yanks (copies) the current line and p pastes it below the cursor; dd followed by p moves a line. A number in front repeats: 3p pastes three times.

    Commands taughtvim-yank

    ▶ Play: The chantSOLUTION HIDDEN16 XP
  6. 30

    Level 30: Needle in the config

    AloneMedium

    Objective: Somewhere in the 80 lines of ~/editor/app.conf debug is on: switch it to debug = off.

    /word searches forward and jumps to the next match; n jumps to the next one, N goes back. Search is the fastest way to move in a big file.

    Commands taughtvim-search

    ▶ Play: Needle in the configSOLUTION HIDDEN24 XP
  7. 31

    Level 31: Line 37

    AloneMedium

    Objective: The parser says line 37 of ~/editor/servers.list is a duplicate: delete exactly that line.

    Error messages give line numbers: :37 jumps straight to line 37 (37G does too). :set nu shows line numbers down the left side.

    Commands taughtvim-lines

    ▶ Play: Line 37SOLUTION HIDDEN24 XP
  8. 32

    Level 32: New name

    AloneMedium

    Objective: The host oldbox was renamed: in ~/editor/hosts.conf replace every oldbox with newbox.

    :%s/old/new/g replaces old with new on every line (%) and every match on a line (g). Without % only the current line changes; without g only the first match per line.

    Commands taughtvim-substitute

    ▶ Play: New nameSOLUTION HIDDEN26 XP
  9. 33

    Level 33: Typo storm

    Alone⏱ TimedHard

    Objective: Kern's daemon won't start: fix the three typos in ~/editor/kern.conf (naem, listne, lgo) before the timer runs out.

    No new keys: search, jump, delete, insert and :s, as fast as you can.

    ▶ Play: Typo stormSOLUTION HIDDEN36 XP
  10. 34

    Level 34: BOSS: The gate

    Boss⏱ TimedHard

    Objective: Repair the gate daemon's config ~/editor/gate.conf with vim only: four fixes, one at a time.

    Real servers have no nano and no mouse, only vi or vim over ssh. Everything you learned in this world, on a config that keeps intruders out.

    ▶ Play: BOSS: The gateSOLUTION HIDDEN60 XP

World 4Reading & searching

19 levels

The great library of logs, where the machine writes down everything and clues hide in a million lines.

  1. 35

    Level 35: The night guard's note

    GuidedEasy

    Objective: The night guard left today's password in /var/log/gate.log: read it with cat and tell Kern, with kern <password>.

    Programs write their diaries into /var/log. cat pours a whole file onto the screen; less opens it page by page (Space down, b up, /word search, q quit).

    Commands taughtcat

    ▶ Play: The night guard's noteSOLUTION HIDDEN12 XP
  2. 36

    Level 36: Last heartbeat

    GuidedEasy

    Objective: Tell Kern the time of the last beat in /var/log/heartbeat.log (tail shows a file's last lines), with kern <HH:MM:SS>.

    head shows the first 10 lines of a file and tail the last 10; -n 3 asks for three. Logs grow at the bottom, so tail sees the news first.

    Commands taughtheadtail

    ▶ Play: Last heartbeatSOLUTION HIDDEN15 XP
  3. 37

    Level 37: Knock knock

    GuidedEasy

    Objective: Count the failed login attempts in /var/log/auth.log with grep -c and tell Kern the number, with kern <number>.

    grep word file prints only the lines that contain word. -c counts them instead, -i ignores upper/lower case, -v shows the lines that do NOT match.

    Commands taughtgrep

    ▶ Play: Knock knockSOLUTION HIDDEN18 XP
  4. 38

    Level 38: First pipes

    GuidedEasy

    Objective: Save the 5 newest failed logins of /var/log/auth.log into ~/last-fails.txt: grep them, then pipe | them into tail.

    A pipe | hands one command's output to the next: grep Failed auth.log | wc -l counts the failures, and | tail -n 5 keeps only the last five. Put > file at the very end and the result lands in a file.

    Commands taughtpipeswc

    ▶ Play: First pipesSOLUTION HIDDEN18 XP
  5. 39

    Level 39: grep: one switch at a time

    GuidedEasy

    Objective: Learn grep's everyday switches on ~/lab/grep/app.log, then use one alone.

    grep has a handful of switches you will use every single day. We try them one at a time on a tiny log.

    ▶ Play: grep: one switch at a timeSOLUTION HIDDEN10 XP
  6. 40

    Level 40: grep: many files, quiet tests

    GuidedEasy

    Objective: Learn grep -r, -l, -x, -q, tail -f and locate on ~/lab/grep, then use them alone.

    grep can search a whole folder at once, print only file names, or stay silent and just answer yes or no.

    Commands taughttimeouttail-follow

    ▶ Play: grep: many files, quiet testsSOLUTION HIDDEN10 XP
  7. 41

    Level 41: Live feed

    AloneMedium

    Objective: A sensor is writing to /var/log/live.log right now — watch it live and tell Kern the reactor code when the ALERT appears.

    tail -f keeps the file open and prints every new line the moment it's written: this is how admins watch a live log. Ctrl+C stops watching.

    Commands taughttail-follow

    ▶ Play: Live feedSOLUTION HIDDEN22 XP
  8. 42

    Level 42: Regex 1: letters and the dot

    GuidedEasy

    Objective: Learn the first regex pieces on ~/lab/regex: plain letters, the dot, and the escaped dot.

    A regex is a pattern that describes text, and each symbol in it has one small job. We learn them one at a time, slowly.

    Commands taughtregex

    ▶ Play: Regex 1: letters and the dotSOLUTION HIDDEN10 XP
  9. 43

    Level 43: Regex 2: star and anchors

    GuidedEasy

    Objective: Learn * .* ^ and $ on ~/lab/regex, then use them alone.

    The star repeats things, and two anchors pin a pattern to the start or the end of a line.

    ▶ Play: Regex 2: star and anchorsSOLUTION HIDDEN10 XP
  10. 44

    Level 44: Regex 3: sets in brackets

    GuidedEasy

    Objective: Learn [ ], ranges like [0-9], and [^ ] on ~/lab/regex, then use them alone.

    Square brackets hold a set: ONE character, picked from the set. A ^ right after [ turns it into 'anything but'.

    ▶ Play: Regex 3: sets in bracketsSOLUTION HIDDEN10 XP
  11. 45

    Level 45: Regex 4: -E, plus and question

    GuidedEasy

    Objective: Learn grep -E, ? and + on ~/lab/regex, then use them alone.

    grep speaks two dialects: basic regex, and extended regex with -E, where + ? { } ( ) | work without backslashes.

    ▶ Play: Regex 4: -E, plus and questionSOLUTION HIDDEN10 XP
  12. 46

    Level 46: Regex 5: counts, or, groups

    GuidedEasy

    Objective: Learn {n}, |, ( ) and grep -cE on ~/lab/regex, then use them alone.

    Curly braces count repeats, | means or, and round brackets group things. Together they read real logs.

    ▶ Play: Regex 5: counts, or, groupsSOLUTION HIDDEN10 XP
  13. 47

    Level 47: Five hundred reasons

    AloneMedium

    Objective: Count the requests in /var/log/web.log that failed with a 5xx server error (status 500–599) and tell Kern.

    grep -E understands patterns: [0-9] is any digit and {2} means 'twice', so 5[0-9]{2} matches 500 to 599. It also matches inside 5123 or /img/500px.png, so add what sits around the code, like the spaces.

    Commands taughtregex

    ▶ Play: Five hundred reasonsSOLUTION HIDDEN28 XP
  14. 48

    Level 48: The card catalogue

    AloneMedium

    Objective: Kern's save file kern-quest.sav is lost somewhere on the disk — find its full path and tell Kern, with kern <path>.

    locate searches a prebuilt index of every file name on the disk, so it answers instantly. The index is only as fresh as the last updatedb, which root runs regularly.

    Commands taughtlocate

    ▶ Play: The card catalogueSOLUTION HIDDEN20 XP
  15. 49

    Level 49: find: walk the tree

    GuidedEasy

    Objective: Learn find with -name, -iname, -type and -maxdepth on ~/lab/find/camp, then use it alone.

    find walks a folder and everything under it, testing every file. Tests like -name and -type keep only what you want.

    Commands taughtfind

    ▶ Play: find: walk the treeSOLUTION HIDDEN10 XP
  16. 50

    Level 50: find: size, age and actions

    GuidedEasy

    Objective: Learn find -size, -mtime, -exec and -delete on ~/lab/find/camp, then use them alone.

    find can also test size and age, and then DO something with every hit: run a command, or delete it.

    ▶ Play: find: size, age and actionsSOLUTION HIDDEN10 XP
  17. 51

    Level 51: Needle in the archive

    Alone⏱ TimedHard

    Objective: One file under /var/log/archive is bigger than 500 KB — copy it into a new folder ~/evidence/.

    find walks a whole folder tree and tests every file, e.g. find /var/log -name '*.log' or -size +500k (bigger than 500 KB). -exec cp {} dir/ ; runs cp on every hit: {} is the file found, ; ends the command.

    Commands taughtfind

    ▶ Play: Needle in the archiveSOLUTION HIDDEN35 XP
  18. 52

    Level 52: Night shift

    Alone⏱ TimedHard

    Objective: A file called reactor.conf names the reactor's live log — find it, watch that log, and tell Kern the code from its next ALERT.

    Real admin work chains the tools: locate finds a file, cat reads it, and tail -f | grep watches a live log for only the lines you care about. Ctrl+C ends the watch.

    ▶ Play: Night shiftSOLUTION HIDDEN40 XP
  19. 53

    Level 53: BOSS: The intruder

    Boss⏱ TimedHard

    Objective: Someone failed over and over, then got in — save every /var/log/auth.log line from that IP into ~/case/intruder.log.

    Every sshd line ends with from <IP>, the visitor's address: Failed password is a miss, Accepted password a way in. An address that misses again and again, then gets Accepted, is the oldest story in the auth log.

    ▶ Play: BOSS: The intruderSOLUTION HIDDEN65 XP

World 5Users & permissions

16 levels

The castle of configuration, where every file has an owner, every door has a lock, and root holds all the keys.

  1. 54

    Level 54: Borrow the crown

    GuidedEasy

    Objective: Read the root-only /etc/kern/secret.conf with sudo cat and tell Kern the motto inside, with kern <motto>.

    root is the all-powerful admin account, and your account can't read its secrets. sudo in front of a command runs that one command as root, if /etc/sudoers says you may, and Kern just put your name on the list.

    Commands taughtsudo

    ▶ Play: Borrow the crownSOLUTION HIDDEN15 XP
  2. 55

    Level 55: Hire an apprentice

    GuidedEasy

    Objective: With sudo, create the group wizards (groupadd) and the user apprentice with a home, in wizards (useradd), then check with id.

    Every user has a name, a number (uid) and groups: id shows them, /etc/passwd and /etc/group list everyone. sudo groupadd, useradd and usermod -aG manage them.

    Commands taughtusersgroups

    ▶ Play: Hire an apprenticeSOLUTION HIDDEN18 XP
  3. 56

    Level 56: Read the locks

    GuidedEasy

    Objective: Exactly one notice in ~/notices can be rewritten by anybody at all: find it and tell Kern with kern <name>.

    ls -l starts each line with a mode like -rw-r-----: after the type come three rwx sets, for the owner, the group and everyone else (others). The next two columns name the owner and the group.

    Commands taughtpermissions

    ▶ Play: Read the locksSOLUTION HIDDEN15 XP
  4. 57

    Level 57: Fireball permit

    GuidedEasy

    Objective: fireball.sh is editable by all, runnable by none: use chmod so you can run it and others can't write it, then cast it with ./fireball.sh.

    ls -l shows rwx three times: for the owner (u), the group (g) and others (o); chmod u+x adds execute for the owner, o-w takes write away from others, and commas combine them. ./fireball.sh then runs the file right here (./ means 'this folder').

    Commands taughtchmod

    ▶ Play: Fireball permitSOLUTION HIDDEN18 XP
  5. 58

    Level 58: Owners and numbers

    GuidedEasy

    Objective: Learn chown, chgrp and chmod with numbers on ~/lab/owners, then use them alone.

    Every file has an owner and a group. chown and chgrp change them, and chmod also takes numbers: one digit each for owner, group and others.

    Commands taughtchownchmod-octal

    ▶ Play: Owners and numbersSOLUTION HIDDEN10 XP
  6. 59

    Level 59: The guild hall

    GuidedEasy

    Objective: Set up /srv/hall in three small steps: give it to group wizards, turn on SGID, then the sticky bit.

    chgrp wizards DIR gives a folder to a group, and on a folder SGID (chmod g+s) makes every new file inside inherit that group. The sticky bit (chmod +t, the t at the end of hidden) lets people delete only their own files there.

    Commands taughtsgidsticky

    ▶ Play: The guild hallSOLUTION HIDDEN18 XP
  7. 60

    Level 60: The guild charter

    AloneMedium

    Objective: Copy ~/charter.txt into /srv/guild, owned by apprentice and group wizards, with mode 640.

    chown user:group file hands a file to someone else, and only root may do it. chmod also takes numbers: r=4, w=2, x=1 added up per triple, so 640 means rw- r-- ---.

    Commands taughtchownchmod-octal

    ▶ Play: The guild charterSOLUTION HIDDEN26 XP
  8. 61

    Level 61: umask: born private

    GuidedEasy

    Objective: Learn umask on ~/lab/umask, then set a mask alone.

    umask is a mask of the permissions new files are born WITHOUT. It lives in your shell and only touches files created after you set it.

    Commands taughtumask

    ▶ Play: umask: born privateSOLUTION HIDDEN10 XP
  9. 62

    Level 62: Born private

    AloneMedium

    Objective: Make every file you create from now on private (600) with umask, then create ~/private/journal.txt.

    umask is the list of permissions new files are born WITHOUT: with umask 022 a new file is 644, with 077 it's 600. It belongs to your shell session.

    Commands taughtumask

    ▶ Play: Born privateSOLUTION HIDDEN25 XP
  10. 63

    Level 63: ACLs: one extra guest

    GuidedEasy

    Objective: Learn getfacl and setfacl -m / -x on /srv/pantry, then grant one user alone.

    Owner, group, others is sometimes too coarse. An ACL adds one more named user (or group) to a single file.

    Commands taughtacl

    ▶ Play: ACLs: one extra guestSOLUTION HIDDEN10 XP
  11. 64

    Level 64: One guest only

    AloneMedium

    Objective: Let user apprentice — and only apprentice — read /srv/kitchen/recipe.txt, while the file stays yours.

    When owner, group and others aren't enough, ACLs add rules for single users: setfacl -m u:name:r file grants one person access, getfacl file lists the rules. ls -l marks such files with a +.

    Commands taughtacl

    ▶ Play: One guest onlySOLUTION HIDDEN28 XP
  12. 65

    Level 65: usermod: join a group

    GuidedEasy

    Objective: Learn usermod -aG on apprentice, see what -G alone does, then fix it alone.

    usermod changes an account that already exists. -aG adds it to a group; forget the -a and it is kicked out of all the others.

    ▶ Play: usermod: join a groupSOLUTION HIDDEN10 XP
  13. 66

    Level 66: The team drop

    Alone⏱ TimedHard

    Objective: Turn /srv/shared into a team drop for wizards, apprentice included: members can write, new files inherit the group, nobody deletes others' files.

    The guild-hall recipe, now from scratch: a group-owned folder the group can write, plus SGID and sticky (as a number: 3775, where 2 = SGID and 1 = sticky). usermod -aG group user adds someone to a group and keeps their other groups.

    ▶ Play: The team dropSOLUTION HIDDEN38 XP
  14. 67

    Level 67: Night handover

    Alone⏱ TimedHard

    Objective: Let apprentice, and only apprentice, read /srv/night/watch.log, make your shell create private files from now on, then create ~/handover.txt.

    The night shift is over and the paperwork is due. Everything it takes, you've already done once tonight.

    ▶ Play: Night handoverSOLUTION HIDDEN40 XP
  15. 68

    Level 68: sudo -u and SUID hunting

    GuidedEasy

    Objective: Learn sudo -u, the s in ls -l and find -perm on /srv/lab-suid, then remove the SUID bits alone.

    sudo -u runs one command as another user instead of root. And a file with the SUID bit runs as its OWNER for everyone: find -perm -4000 spots them.

    Commands taughtsuid

    ▶ Play: sudo -u and SUID huntingSOLUTION HIDDEN10 XP
  16. 69

    Level 69: BOSS: Site down

    Boss⏱ TimedHard

    Objective: The site is down: make /srv/www/start.sh work for user server (it writes into /srv/www/logs) and remove the sneaky SUID backdoor hidden in /srv/www.

    SUID (u+s) makes a program run as its owner no matter who starts it, so a root-owned copy of a shell is a backdoor: find -perm -4000 hunts those down. sudo -u server cmd runs cmd as user server, to see exactly what they can and can't do.

    Commands taughtsuid

    ▶ Play: BOSS: Site downSOLUTION HIDDEN65 XP

World 6Accounts

19 levels

The castle's back office: hiring, passwords, holidays, expiry dates and goodbyes. (This lab keeps no login records, so sessions are tracked as processes.)

  1. 70

    Level 70: The account book

    GuidedEasy

    Objective: Read the two account files and answer Kern's two questions.

    Every account is one line of /etc/passwd: name:x:UID:GID:comment:home:shell, seven fields split by colons. The password hashes live apart in /etc/shadow, which only root may read.

    Commands taughtpasswd-fileshadow

    ▶ Play: The account bookSOLUTION HIDDEN16 XP
  2. 71

    Level 71: Ask the phone book

    GuidedEasy

    Objective: kade can't open /srv/audit: check his groups with id and the group with getent, add him to auditors (usermod -aG), check again.

    id NAME shows a user's UID and every group they belong to; getent passwd NAME and getent group NAME ask the system's account sources (files today, a company directory tomorrow).

    Commands taughtgetent

    ▶ Play: Ask the phone bookSOLUTION HIDDEN16 XP
  3. 72

    Level 72: A password for tess

    GuidedEasy

    Objective: New hire tess can't log in because she has no password yet: give her one with hidden (any you like).

    sudo passwd NAME sets someone else's password: you type it twice and nothing shows on screen, not even stars. Plain passwd changes your own.

    Commands taughtpasswd

    ▶ Play: A password for tessSOLUTION HIDDEN16 XP
  4. 73

    Level 73: chage: password calendars

    GuidedEasy

    Objective: Learn chage -l, -M and -E on rowan, then set nell's calendar alone.

    chage sets the calendar of an account: how many days a password lives, and the day the whole account switches off.

    Commands taughtchage

    ▶ Play: chage: password calendarsSOLUTION HIDDEN10 XP
  5. 74

    Level 74: The contractor

    AloneMedium

    Objective: Contractor ivo: password must change every 90 days, and the account must expire on 2027-06-30.

    chage manages password aging: chage -l NAME shows the rules, -M DAYS forces a new password every DAYS days, and -E YYYY-MM-DD switches the account off on that date.

    Commands taughtchage

    ▶ Play: The contractorSOLUTION HIDDEN24 XP
  6. 75

    Level 75: Gone fishing

    GuidedEasy

    Objective: rowan leaves for a month of fishing and nell is back from hers: lock rowan, unlock nell.

    usermod -L NAME locks a password (passwd -l does the same) by putting a ! in front of the hash; usermod -U NAME takes it away. passwd -S NAME shows L for locked, P for usable.

    Commands taughtusermod

    ▶ Play: Gone fishingSOLUTION HIDDEN18 XP
  7. 76

    Level 76: Login shells

    GuidedEasy

    Objective: Learn to read and change a login shell with usermod -s, then lock nell out alone.

    The last field of an account in /etc/passwd is its login shell: the program you get after logging in. usermod -s swaps it.

    ▶ Play: Login shellsSOLUTION HIDDEN10 XP
  8. 77

    Level 77: No shell for robots

    AloneMedium

    Objective: backupbot is a service account, but it has a real shell: change its login shell to /sbin/nologin.

    The last field of /etc/passwd is the login shell. Service accounts get /sbin/nologin, which politely refuses every login while the account can still own files and run its jobs.

    Commands taughtnologin

    ▶ Play: No shell for robotsSOLUTION HIDDEN24 XP
  9. 78

    Level 78: tee: write where you cannot

    GuidedEasy

    Objective: Learn ls -A, tee, tee -a and sudo tee, then write a root-owned file alone.

    tee copies what flows through a pipe into a file and onto the screen. With sudo in front, it writes into root's folders.

    Commands taughttee

    ▶ Play: tee: write where you cannotSOLUTION HIDDEN10 XP
  10. 79

    Level 79: The welcome kit

    AloneMedium

    Objective: Every new account should start with a README.txt: put one in /etc/skel, then create user pip with a home to prove it works.

    useradd -m copies everything in /etc/skel into the new home folder. It happens once, at creation: change skel later and old users never notice.

    Commands taughtskel

    ▶ Play: The welcome kitSOLUTION HIDDEN24 XP
  11. 80

    Level 80: su: wear another hat

    GuidedEasy

    Objective: Learn su -, su -c and exit, then run a command as tess alone.

    su - NAME opens a new shell as another user, after asking for THEIR password. exit takes the hat off again.

    Commands taughtsu

    ▶ Play: su: wear another hatSOLUTION HIDDEN10 XP
  12. 81

    Level 81: Wearing another hat

    GuidedEasy

    Objective: Check your sudo rights, then become tess twice: once with her password, once with sudo.

    sudo -l lists what you may run as root. su - NAME starts a login shell as NAME with NAME's password (exit takes the hat off); sudo -u NAME CMD runs one command as NAME with your own sudo rights, and sudo -i -u NAME opens a whole shell.

    Commands taughtswitch-user

    ▶ Play: Wearing another hatSOLUTION HIDDEN18 XP
  13. 82

    Level 82: Who is here, what do they run

    GuidedEasy

    Objective: Learn w, ps -u, pgrep -u and pkill -u, then end nell's processes alone.

    w lists who is logged in. Everything a user does is processes they own: ps -u lists them and pkill -u ends them.

    Commands taughtpspgrepsessions

    ▶ Play: Who is here, what do they runSOLUTION HIDDEN10 XP
  14. 83

    Level 83: Who's still here?

    AloneMedium

    Objective: kade left this morning, but his programs are still running: stop every process of kade's, and only his.

    On a real server who and w list who is logged in, and last lists who was. Every session is just processes owned by a user: ps -u NAME lists them and pkill -u NAME ends them all.

    Commands taughtsessions

    ▶ Play: Who's still here?SOLUTION HIDDEN26 XP
  15. 84

    Level 84: Removing accounts and groups

    GuidedEasy

    Objective: Learn gpasswd -d / -a, userdel -r and groupdel, then remove kade and a group alone.

    People leave groups, and sometimes the castle. gpasswd -d takes a member out of a group, userdel -r removes a user and their home, groupdel a group.

    Commands taughtuserdelgpasswd

    ▶ Play: Removing accounts and groupsSOLUTION HIDDEN10 XP
  16. 85

    Level 85: Shift change

    Alone⏱ TimedHard

    Objective: Shift change: intern1 leaves, newbie arrives, and nell moves out of auditing.

    userdel -r NAME deletes an account and its home, groupdel GROUP removes a group, and gpasswd -d NAME GROUP takes one user out of one group.

    Commands taughtuserdelgpasswd

    ▶ Play: Shift changeSOLUTION HIDDEN40 XP
  17. 86

    Level 86: Hidden jobs and hidden rights

    GuidedEasy

    Objective: Learn hidden -u, crontab -r -u and sudo -l -U on kade, then clear nell's jobs alone.

    A user can leave timed jobs (a crontab) and sudo rights behind. crontab -u and sudo -l -U let root look at someone else's.

    Commands taughtcron

    ▶ Play: Hidden jobs and hidden rightsSOLUTION HIDDEN10 XP
  18. 87

    Level 87: tar: pack a folder

    GuidedEasy

    Objective: Learn tar c, t, x, z, j, v, f and -C on ~/lab/tar, then pack a folder alone.

    tar packs a whole folder into one archive file, often squeezed with gzip: name.tar.gz. Its options are single letters you combine.

    Commands taughttar

    ▶ Play: tar: pack a folderSOLUTION HIDDEN10 XP
  19. 88

    Level 88: BOSS: Offboarding

    Boss⏱ TimedHard

    Objective: Offboard vex: shut every door he had, but keep his files for the auditors.

    Offboarding shuts every door an employee had: password, account, shell, sudo, running processes, scheduled jobs. The files stay, archived, until the auditors are done.

    Commands taughtoffboarding

    ▶ Play: BOSS: OffboardingSOLUTION HIDDEN70 XP

World 7Text Power

18 levels

The device forge, where streams flow through pipes and you bend text with sort, cut, sed and awk.

  1. 89

    Level 89: Two mouths

    GuidedEasy

    Objective: The oracle mixes prophecies and complaints: save prophecies to ~/prophecy.txt and complaints to ~/complaints.txt.

    Every program has two output streams: stdout (1) for answers and stderr (2) for complaints. > catches stream 1, 2> catches stream 2.

    Commands taughtstreamsstderr-redirect

    ▶ Play: Two mouthsSOLUTION HIDDEN15 XP
  2. 90

    Level 90: One bucket

    GuidedEasy

    Objective: Run chatterbox so your screen stays silent and ~/all.log gets both of its streams.

    2>&1 means: send stream 2 wherever stream 1 is going right now. So write > file first, then 2>&1, and both land in the same file.

    ▶ Play: One bucketSOLUTION HIDDEN18 XP
  3. 91

    Level 91: Feed the seal

    GuidedEasy

    Objective: seal only listens on stdin: feed it ~/scrolls.txt with < and save what it says in ~/sealed.txt.

    Programs have a mouth for input too: stdin, stream 0. < file pours a file into it, so sort < names.txt or wc -l < names.txt read it without being given its name.

    Commands taughtstdin-redirect

    ▶ Play: Feed the sealSOLUTION HIDDEN16 XP
  4. 92

    Level 92: The bestseller

    GuidedEasy

    Objective: ~/sales.txt logs every potion sold today: count them with sort and uniq -c, then tell Kern the bestseller with kern <potion>.

    A pipe | feeds one command's output straight into the next command. uniq -c counts repeated lines, but only neighbours, so sort first.

    Commands taughtsortuniq

    ▶ Play: The bestsellerSOLUTION HIDDEN20 XP
  5. 93

    Level 93: awk 1: fields

    GuidedEasy

    Objective: Learn awk fields ($1, $NF, NR, -F) on ~/lab/awk/crew.txt, then use them alone.

    awk cuts every line into fields, $1, $2, $3..., split at spaces. Then a tiny program in { } says what to print.

    Commands taughtawk

    ▶ Play: awk 1: fieldsSOLUTION HIDDEN10 XP
  6. 94

    Level 94: awk 2: filters and totals

    GuidedEasy

    Objective: Learn awk conditions, /regex/, += and END on ~/lab/awk/crew.txt, then use them alone.

    Put a condition in front of the { } and awk only acts on the lines that pass it. END runs once, after the last line.

    ▶ Play: awk 2: filters and totalsSOLUTION HIDDEN10 XP
  7. 95

    Level 95: The dragon tax

    GuidedEasy

    Objective: Three awk steps on ~/ledger.txt: print column 2, then only the dragon rows, then add up their gold and tell Kern with kern <total>.

    awk splits every line into fields $1, $2, $3…: awk '{ print $2 }' file prints the second column of every line. You'll grow that one-liner in three small steps.

    Commands taughtawk

    ▶ Play: The dragon taxSOLUTION HIDDEN20 XP
  8. 96

    Level 96: sed 1: find and replace

    GuidedEasy

    Objective: Learn sed s///, g, other delimiters and -i on ~/lab/sed, then use them alone.

    sed edits text as it flows past: s/old/new/ swaps old for new. It only prints the result, unless you add -i.

    Commands taughtsed

    ▶ Play: sed 1: find and replaceSOLUTION HIDDEN10 XP
  9. 97

    Level 97: sed 2: pick and delete lines

    GuidedEasy

    Objective: Learn sed -n with p, addresses, d and -e on ~/lab/sed/team.conf, then use them alone.

    sed can also pick lines, by number or by regex, then print or delete them. -n keeps it quiet unless you ask.

    ▶ Play: sed 2: pick and delete linesSOLUTION HIDDEN10 XP
  10. 98

    Level 98: xargs: hand over the list

    GuidedEasy

    Objective: Learn xargs and xargs -0 in ~/lab/xargs, then use them alone.

    Some commands read file names from their arguments, not from a pipe. xargs turns the lines it reads into arguments.

    Commands taughtxargs

    ▶ Play: xargs: hand over the listSOLUTION HIDDEN10 XP
  11. 99

    Level 99: The sign painter

    GuidedEasy

    Objective: Repaint old-tower to new-tower on the signs in ~/signs: one rehearsal, one sign, then all the rest at once.

    sed 's/old/new/g' file prints the file with every old swapped for new and changes nothing; sed -i writes the change into the file itself. xargs turns a list of names from a pipe into arguments: grep -l old *.sign | xargs sed -i 's/old/new/g'.

    Commands taughtsedxargs

    ▶ Play: The sign painterSOLUTION HIDDEN22 XP
  12. 100

    Level 100: cut, tr, sort, head

    GuidedEasy

    Objective: Learn cut -d -f, tr, sort -u, sort -rn and head -n on ~/lab/text/guild.csv, then use them alone.

    Small tools, one job each: cut keeps columns, tr swaps characters, sort orders lines, head keeps the top. Pipes chain them.

    Commands taughtcuttr

    ▶ Play: cut, tr, sort, headSOLUTION HIDDEN10 XP
  13. 101

    Level 101: Silence the denied

    AloneMedium

    Objective: List every .key file you can find under /srv/vault into ~/keys.txt, with no Permission denied spam on screen.

    /dev/null is the machine's black hole: whatever you send there vanishes. Sending stream 2 there hides error spam and keeps the good output.

    Commands taughtdev-null

    ▶ Play: Silence the deniedSOLUTION HIDDEN25 XP
  14. 102

    Level 102: Guild mailing list

    AloneMedium

    Objective: Make ~/emails.txt: only the email column of ~/guild.csv, all in lowercase.

    cut -d, -f3 keeps only the third comma-separated column. tr swaps characters, like turning every capital into a small letter.

    Commands taughtcuttr

    ▶ Play: Guild mailing listSOLUTION HIDDEN25 XP
  15. 103

    Level 103: The tower moved

    Alone⏱ TimedHard

    Objective: 300 configs live under ~/realm: every old-tower must become new-tower, fast.

    Same paint job as the signs, at realm scale: grep -r searches a whole tree and -l prints only the file names. Pipe that list into xargs sed -i 's/old/new/g'.

    ▶ Play: The tower movedSOLUTION HIDDEN40 XP
  16. 104

    Level 104: Meet the census program

    GuidedEasy

    Objective: Feed census the small practice registry in ~/lab/census, then use it alone.

    census reads a sealed town registry on stdin and prints one row per citizen. It also grumbles on stderr, so keep your streams apart.

    ▶ Play: Meet the census programSOLUTION HIDDEN10 XP
  17. 105

    Level 105: Census night

    Alone⏱ TimedHard

    Objective: Save census's full transcript, rows and warnings, to ~/census.log, and list its towns, lowercase and once each, in ~/towns.txt.

    The census program reads the sealed registry /srv/census/registry.b64 on stdin and grumbles on stderr. Two thousand citizens: let the pipes do the counting.

    ▶ Play: Census nightSOLUTION HIDDEN42 XP
  18. 106

    Level 106: BOSS: Gatecrashers

    Boss⏱ TimedHard

    Objective: Put the 3 IPs with the most failed logins (401) into ~/blocklist.txt, one per line.

    Someone is hammering the login gate: 50,000 lines of /var/log/gate/access.log, and a 401 means a failed login. Nobody reads that by hand.

    ▶ Play: BOSS: GatecrashersSOLUTION HIDDEN65 XP

World 8Bash Scripting

12 levels

The spell library, where every tool is a file and you learn to write programs of your own.

  1. 107

    Level 107: Your first spell

    GuidedEasy

    Objective: Write ~/hello.sh that greets Kern (with nano, echo or printf), make it executable with chmod +x and run it.

    A script is a text file full of commands; its first line #!/bin/bash says which program reads it. chmod +x makes it runnable, and ./name runs it.

    Commands taughtscriptsprintf

    ▶ Play: Your first spellSOLUTION HIDDEN18 XP
  2. 108

    Level 108: Name badge

    GuidedEasy

    Objective: Write ~/badge.sh so it prints 'User: <user> Home: <home>' from $USER and $HOME (not typed-in values), then run it with bash.

    A variable is a named box: name=Kern stores, $name opens it. Double quotes open the boxes, single quotes keep the text exactly as typed.

    Commands taughtvariablesquoting

    ▶ Play: Name badgeSOLUTION HIDDEN20 XP
  3. 109

    Level 109: Is it up?

    GuidedEasy

    Objective: Write ~/isup.sh in two steps: print UP when the file named by $1 exists and DOWN when not, then make DOWN exit with code 1.

    $1 is the first word you pass to a script, and if [ -e "$1" ]; then …; else …; fi picks a branch by whether that file exists. Exit codes come right after, as step 2.

    Commands taughtscript-argsifexit-codes

    ▶ Play: Is it up?SOLUTION HIDDEN22 XP
  4. 110

    Level 110: Shortcuts

    GuidedEasy

    Objective: Make ll a shortcut for ls -la that every new shell knows: an alias in ~/.bashrc, loaded now with hidden.

    ~/.bashrc runs at the start of every new bash, so whatever you write there, every future shell knows. alias name='command' makes a shortcut, like alias ll='ls -la'.

    Commands taughtaliassourcebashrc

    ▶ Play: ShortcutsSOLUTION HIDDEN18 XP
  5. 111

    Level 111: Scroll roll call

    GuidedEasy

    Objective: Rename the 12 scrolls in ~/scrolls from .txt to .md with one loop.

    hidden runs the body once per file, with $f holding the current name. ${f%.txt} is $f with .txt chopped off the end, so mv "$f" "${f%.txt}.md" renames one scroll.

    Commands taughtloopsparam-expansion

    ▶ Play: Scroll roll callSOLUTION HIDDEN22 XP
  6. 112

    Level 112: The spellbook

    AloneMedium

    Objective: Write ~/spells.sh with a function heal that prints 'Healed <N> HP', load it with source, and cast heal 50.

    A function is a mini-command you define yourself: heal() { echo "Healed $1 HP"; }. source file loads a file's functions into your current shell.

    Commands taughtfunctions

    ▶ Play: The spellbookSOLUTION HIDDEN26 XP
  7. 113

    Level 113: Loot from anywhere

    AloneMedium

    Objective: Make Kern's ~/loot.sh a real command: it should run as plain loot from anywhere, now and in every new shell.

    When you type a bare command name, bash searches the folders listed in $PATH. Put your scripts in ~/bin, add ~/bin to PATH in ~/.bashrc, and they work everywhere.

    Commands taughtpath-var

    ▶ Play: Loot from anywhereSOLUTION HIDDEN28 XP
  8. 114

    Level 114: Night shift

    AloneMedium

    Objective: Schedule ~/bin/backup.sh to run every 5 minutes with your crontab.

    cron runs commands on a schedule, one line per job: minute hour day month weekday command. */5 in the minute field means every 5 minutes; crontab -e edits your list.

    Commands taughtcron

    ▶ Play: Night shiftSOLUTION HIDDEN28 XP
  9. 115

    Level 115: Photo flood

    Alone⏱ TimedHard

    Objective: Rename all 300 photos in ~/photos from .JPG to lowercase .jpg before the camera fills up again.

    The scroll loop again, under fire: for f in *.JPG; do …; done visits every photo. ${f%.JPG} chops .JPG off the end, so you can add .jpg back.

    ▶ Play: Photo floodSOLUTION HIDDEN38 XP
  10. 116

    Level 116: Welcome mat

    Alone⏱ TimedHard

    Objective: In ~/.bashrc, define greet so greet "<name>" prints Welcome, <name>. with the name exactly as given, plus an alias hi that runs greet Kern.

    Kern wants a proper welcome in every shell he opens. Functions, quotes, aliases and ~/.bashrc: you own every piece.

    ▶ Play: Welcome matSOLUTION HIDDEN42 XP
  11. 117

    Level 117: Boxes that catch output

    GuidedEasy

    Objective: Learn VAR=value, $( ), -gt and || true on ~/lab/guard, then write a tiny checker alone.

    A variable can hold a command's answer: n=$(whoami) runs whoami and keeps what it prints. Then [ "$n" -gt 0 ] compares numbers.

    ▶ Play: Boxes that catch outputSOLUTION HIDDEN10 XP
  12. 118

    Level 118: BOSS: The guard

    Boss⏱ TimedHard

    Objective: Write ~/bin/guard FILE: missing file → MISSING, exit 2; ERROR lines → their count, exit 1; else OK, exit 0.

    A guard program reads a log and reports with words and exit codes, using $1, if, echo and exit. $(command) captures a command's output: n=$(grep -c ERROR "$1") stores the number of ERROR lines in n.

    Commands taughtcommand-substitution

    ▶ Play: BOSS: The guardSOLUTION HIDDEN60 XP

World 9Your Environment

12 levels

The cloakroom where every shell gets dressed: variables, startup files, prompts, limits and time zones, for you and for every user.

  1. 119

    Level 119: Pass it on

    GuidedEasy

    Objective: Make ~/env/beacon.sh glow green: it reads the color from the environment variable BEACON_COLOR, so set it and export it.

    NAME=value makes a shell variable that only this shell sees. export NAME (or export NAME=value) puts it in the environment, which every program you start inherits; env lists the environment.

    Commands taughtexport

    ▶ Play: Pass it onSOLUTION HIDDEN14 XP
  2. 120

    Level 120: Two doors

    GuidedEasy

    Objective: Find out which kind of shell sees the SPARK=lit set in /etc/profile.d, then tell Kern: hidden or kern nonlogin.

    A login shell (console login, ssh, bash -l, sudo -i) reads /etc/profile, /etc/profile.d/*.sh and ~/.bash_profile. A non-login interactive shell (typing bash, most terminal tabs) reads ~/.bashrc instead.

    Commands taughtlogin-shells

    ▶ Play: Two doorsSOLUTION HIDDEN16 XP
  3. 121

    Level 121: The house motto

    GuidedEasy

    Objective: Give every user's login shell KERN_MOTTO=curious with a new file in /etc/profile.d, then check it with printenv.

    Any file /etc/profile.d/NAME.sh is run by every login shell of every user: the clean way to set system-wide variables. Everyone must be able to read it (chmod 644); sudo -i -u USER opens a login shell as USER to test it.

    Commands taughtprofile-files

    ▶ Play: The house mottoSOLUTION HIDDEN18 XP
  4. 122

    Level 122: Name tag

    AloneMedium

    Objective: Make every new shell's prompt look like [kern] guest@host:folder$ , set in your ~/.bashrc.

    PS1 is the prompt: \u is the user, \h the host, \w the folder and \$ shows $ (or # for root). Set it in ~/.bashrc so every new shell wears it.

    Commands taughtps1

    ▶ Play: Name tagSOLUTION HIDDEN24 XP
  5. 123

    Level 123: Full house

    GuidedEasy

    Objective: ~/env/crowd.sh must seat 1500 guests (1500 open files) but stops near 1000: raise your limit with hidden, run it again.

    Every open file uses a file descriptor, and hidden caps how many one process may hold: hit it and you get 'Too many open files'. hidden N raises your soft limit up to the hard limit (hidden); children inherit it.

    Commands taughtulimit

    ▶ Play: Full houseSOLUTION HIDDEN18 XP
  6. 124

    Level 124: date and time zones

    GuidedEasy

    Objective: Learn date, date -u, +formats and TZ=zone cmd in ~/lab/clock, then find New York's offset alone.

    date prints the time; -u shows UTC. Put TZ=zone in front of a command and that one command sees the clock of another zone.

    Commands taughttimezone

    ▶ Play: date and time zonesSOLUTION HIDDEN10 XP
  7. 125

    Level 125: Tokyo time

    AloneMedium

    Objective: The Tokyo office wants its report in their time: run ~/env/report.sh so it stamps UTC+9.

    The kernel keeps time in UTC; TZ tells programs which zone to show. hidden shows UTC+9 for that one command (POSIX form: name, then hours WEST of UTC, so minus means east); date -u always shows UTC.

    Commands taughttimezone

    ▶ Play: Tokyo timeSOLUTION HIDDEN24 XP
  8. 126

    Level 126: pgrep -f and prlimit

    GuidedEasy

    Objective: Find snackd with pgrep -f, read its open-file limit with prlimit, then raise it alone.

    pgrep -f finds a process by its command line. prlimit --pid N reads or changes the limits of a process that is already running, like its open files.

    Commands taughtlimits

    ▶ Play: pgrep -f and prlimitSOLUTION HIDDEN10 XP
  9. 127

    Level 127: The hungry daemon

    AloneMedium

    Objective: feastd (user server) is starved at 64 open files: give the running daemon 4096 now, and write the limit into limits.conf for next time.

    Root can change a running process's limits with prlimit --pid PID --nofile=SOFT:HARD. For next time, /etc/security/limits.conf lines like server - nofile 4096 (user, soft/hard/- for both, item, value) are applied by PAM at each login.

    Commands taughtlimits

    ▶ Play: The hungry daemonSOLUTION HIDDEN28 XP
  10. 128

    Level 128: The night report

    Alone⏱ TimedHard

    Objective: PAGER: the Tokyo nightly report is late, so run ~/env/nightly.sh with enough open files and a UTC+9 stamp.

    Limits and environment travel together into every program you start: set both, then run.

    ▶ Play: The night reportSOLUTION HIDDEN38 XP
  11. 129

    Level 129: kerntool and new users

    GuidedEasy

    Objective: Run kerntool by path, then by name, then create a user with bash as their shell.

    kerntool is Kern's health checker, hidden in /opt/kerntools/bin. A command runs by name only when its folder is on the PATH, and useradd -s picks a new user's shell.

    ▶ Play: kerntool and new usersSOLUTION HIDDEN10 XP
  12. 130

    Level 130: BOSS: Welcome kit

    Boss⏱ TimedHard

    Objective: Prepare the machine for new hire nova: tools on everyone's PATH, a welcome .bashrc for new users, the account itself, and a file limit.

    System-wide settings live in /etc/profile.d (every login), new users are cloned from /etc/skel, and limits.conf feeds PAM at login. Your own shell's settings reach nobody else.

    ▶ Play: BOSS: Welcome kitSOLUTION HIDDEN65 XP

World 10Processes

14 levels

The engine room, where programs come alive as processes and you learn to watch, pause and stop them.

  1. 131

    Level 131: Who's running?

    GuidedEasy

    Objective: A process called gremlin is hiding among the others: find its PID and tell Kern with kern <pid>.

    Every running program is a process with a number, its PID. ps lists processes; ps aux shows every process on the machine, with its owner and command.

    Commands taughtprocessesps

    ▶ Play: Who's running?SOLUTION HIDDEN18 XP
  2. 132

    Level 132: The lurker

    GuidedEasy

    Objective: lurker is hiding somewhere on disk: find the folder it stands in and tell Kern with kern <path>.

    Each process has a live folder, /proc/<PID>, full of facts: cmdline, status, open files in fd/. Its cwd is a link to the folder the process stands in.

    Commands taughtprocfspgrep

    ▶ Play: The lurkerSOLUTION HIDDEN20 XP
  3. 133

    Level 133: Background nap

    GuidedEasy

    Objective: Start a long nap, sleep 4242, in the background with & so your prompt stays free, then see it listed with jobs.

    End a command with & and it runs in the background while you keep typing. jobs lists them, fg brings one back to the front, Ctrl-Z pauses it and bg resumes it behind you.

    Commands taughtbackground-jobsjobs

    ▶ Play: Background napSOLUTION HIDDEN18 XP
  4. 134

    Level 134: The pause button

    GuidedEasy

    Objective: Run hidden, freeze it with Ctrl-Z, resume it with bg, then bring it back with fg and end it with Ctrl-C.

    Ctrl-Z freezes the command holding your terminal and gives you the prompt back. bg lets it keep running behind you, jobs lists it, fg brings it back to the front, where Ctrl-C can stop it.

    Commands taughtjob-control

    ▶ Play: The pause buttonSOLUTION HIDDEN18 XP
  5. 135

    Level 135: Stubborn

    GuidedEasy

    Objective: The process stubborn ignores polite requests: ask politely with kill first, then make it go away with kill -9.

    kill sends a signal to a PID: by default SIGTERM, a polite 'please stop' that lets a process save its work, but it may ignore it. SIGKILL (kill -9) can't be ignored and skips all cleanup, so it's the last resort, after a polite kill and a moment of patience.

    Commands taughtkillsignals

    ▶ Play: StubbornSOLUTION HIDDEN22 XP
  6. 136

    Level 136: New orders

    GuidedEasy

    Objective: Change the message in ~/herald.conf to dragons sighted, then make the running herald pick it up without stopping it.

    Many daemons treat SIGHUP as 'reload your settings': same process, same PID, new config, no downtime. kill -HUP <PID> sends it.

    ▶ Play: New ordersSOLUTION HIDDEN20 XP
  7. 137

    Level 137: Signals: TERM, STOP, CONT

    GuidedEasy

    Objective: Count the bees, stop buzz politely, freeze and wake humd, then wake snorer alone.

    kill sends a signal, not always death. 15 (TERM) asks politely, 9 (KILL) is the last resort, STOP freezes a process and CONT wakes it up.

    ▶ Play: Signals: TERM, STOP, CONTSOLUTION HIDDEN10 XP
  8. 138

    Level 138: Freeze!

    AloneMedium

    Objective: loudmouth keeps scribbling into ~/noise.txt: freeze it without killing it, Kern needs it later.

    Signals don't only kill: SIGSTOP freezes a process mid-step and SIGCONT wakes it up exactly where it was.

    ▶ Play: Freeze!SOLUTION HIDDEN26 XP
  9. 139

    Level 139: nice, renice and top

    GuidedEasy

    Objective: See NI with ps and top, renice digger, then start the endless rebuild job politely alone.

    Every process has a nice value: -20 greedy to 19 polite. nice -n starts a command politely, renice changes one that is already running.

    ▶ Play: nice, renice and topSOLUTION HIDDEN10 XP
  10. 140

    Level 140: Be nice

    AloneMedium

    Objective: miner may keep running, but only when nobody else needs the CPU: give it niceness 19.

    Niceness runs from -20 (greedy) to 19 (polite): the higher it is, the more a process lets others go first. nice starts a program politely, renice changes a running one.

    Commands taughtnicetop

    ▶ Play: Be niceSOLUTION HIDDEN26 XP
  11. 141

    Level 141: The lost journal

    AloneMedium

    Objective: Kern deleted his journal, but the process scribe still holds it open: copy it back to ~/journal.txt.

    /proc/<PID>/fd lists a process's open files as numbered links. A deleted file lives on while someone still holds it open, and you can copy it back from there.

    Commands taughtfile-descriptors

    ▶ Play: The lost journalSOLUTION HIDDEN30 XP
  12. 142

    Level 142: Rush hour

    Alone⏱ TimedHard

    Objective: Run rebuild at nice 10 or more and keep it going in the background, then find the folder the ghost process works in: kern <folder>.

    Rush hour in the engine room: a slow rebuild has to run, and a ghost haunts a folder somewhere. You'll need your prompt free for both.

    ▶ Play: Rush hourSOLUTION HIDDEN42 XP
  13. 143

    Level 143: The ps table

    GuidedEasy

    Objective: Build a ps table with -e, -o and --sort, then find the CPU hog and stop it by exact name.

    ps -e lists every process. -o picks the columns (ppid is the parent), and --sort=-pcpu puts the biggest CPU user on top.

    ▶ Play: The ps tableSOLUTION HIDDEN10 XP
  14. 144

    Level 144: BOSS: The hydra

    Boss⏱ TimedHard

    Objective: Find the CPU eater and stop it for good, without killing innocent processes.

    The machine is crawling: something burns the CPU, and when you kill it, it grows back. top and ps --sort=-pcpu name the hungriest; the PPID column names who spawned it.

    ▶ Play: BOSS: The hydraSOLUTION HIDDEN65 XP

World 11Performance & Capacity

11 levels

Read load, memory, I/O and syscalls like a pro, tame hogs with nice and cgroups, and catch the OOM killer in the act.

  1. 145

    Level 145: Read the load

    GuidedEasy

    Objective: Judge five server snapshots in a row: overloaded or ok?

    uptime's load average is how many tasks wanted a CPU (or waited on disk) over 1, 5 and 15 minutes. Compare it with the CPU count (nproc): load 4 on 8 CPUs is fine, load 4 on 2 CPUs is a queue.

    Commands taughtuptime

    ▶ Play: Read the loadSOLUTION HIDDEN30 XP
  2. 146

    Level 146: Free is not available

    GuidedEasy

    Objective: How many MB of memory are available on this box right now? kern <MB>.

    free -m shows memory in MB. 'free' is unused RAM; 'available' adds the cache Linux can drop at once, so available is the number that matters. Both come from /proc/meminfo (MemAvailable).

    Commands taughtfree

    ▶ Play: Free is not availableSOLUTION HIDDEN25 XP
  3. 147

    Level 147: vmstat: find the bottleneck

    GuidedEasy

    Objective: Read four vmstat snapshots from prod servers in a row and name each bottleneck: cpu, memory or io.

    vmstat 1 prints one line a second: r (waiting for CPU), b (blocked on I/O), si/so (swapping), us/sy/id/wa (CPU time; wa = waiting for disk). High r+us = CPU, si/so + tiny free = memory, b + wa = I/O. iostat -x and mpstat (sysstat) zoom in on disks and CPUs.

    Commands taughtvmstat

    ▶ Play: vmstat: find the bottleneckSOLUTION HIDDEN35 XP
  4. 148

    Level 148: Be nice (renice, ionice)

    GuidedEasy

    Objective: The report job w07b-report must finish, but politely: renice it to 15 or more and put w07b-backup in the idle I/O class.

    renice -n 15 -p PID lowers a running process's CPU priority (higher nice = more polite; only root can raise priority). ionice -c3 -p PID puts its disk I/O in the idle class. Polite beats killed for jobs that must finish.

    Commands taughtionice

    ▶ Play: Be nice (renice, ionice)SOLUTION HIDDEN30 XP
  5. 149

    Level 149: strace: watch the syscalls

    GuidedEasy

    Objective: harbor-report dies with a useless 'error': run it under strace to find the exact file it fails to open (kern <path>).

    strace runs a program and prints every system call it makes. -e trace=%file shows only file opens/stats: a failing open with ENOENT names the missing file even when the program's error message says nothing.

    Commands taughtstrace

    ▶ Play: strace: watch the syscallsSOLUTION HIDDEN35 XP
  6. 150

    Level 150: Live gauges

    GuidedEasy

    Objective: Read vmstat, top, ps --sort and the kernel log in ~/lab/perf, then save the kernel's last words alone.

    Before fixing a slow box, read its gauges: vmstat for the bottleneck, top for the busiest processes, dmesg for what the kernel itself saw.

    Commands taughtdmesg

    ▶ Play: Live gaugesSOLUTION HIDDEN10 XP
  7. 151

    Level 151: Who killed the app? (OOM)

    AloneMedium

    Objective: Tell Kern how many times the OOM killer struck the app in cgroup w07b-app: kern <count>.

    When a cgroup hits memory.max, the kernel's OOM killer kills a process in it and logs it: dmesg shows 'Memory cgroup out of memory: Killed process'. memory.events in the cgroup counts oom_kill.

    Commands taughtoom-killer

    ▶ Play: Who killed the app? (OOM)SOLUTION HIDDEN40 XP
  8. 152

    Level 152: Zombie harbor

    AloneMedium

    Objective: Clear the zombies on the dock: find their parent and stop it gracefully.

    A zombie (STAT Z) already exited; it waits for its parent to read its exit code. You cannot kill the dead: stop the parent (SIGTERM first) and init adopts and reaps them.

    ▶ Play: Zombie harborSOLUTION HIDDEN40 XP
  9. 153

    Level 153: Memory hog, 2 minutes

    Alone⏱ TimedHard

    Objective: Find the process using the most memory (RSS), tell Kern its PID, then stop it with SIGTERM.

    PAGER: memory available is nearly gone (vmstat: tiny free, the box is starving). Find the biggest resident process and stop it gracefully.

    ▶ Play: Memory hog, 2 minutesSOLUTION HIDDEN45 XP
  10. 154

    Level 154: Stuck on what?

    Alone⏱ TimedHard

    Objective: w07b-sync is frozen: find which file it is blocked reading. kern <path>.

    strace -p PID attaches to a running process: a hang shows as one blocked call, like read(3, ...). /proc/PID/fd/3 then tells you which file fd 3 is.

    ▶ Play: Stuck on what?SOLUTION HIDDEN45 XP
  11. 155

    Level 155: BOSS: The slow server

    Boss⏱ TimedHard

    Objective: Clear the zombies, make the report polite (nice 10+), and stop the OOM kills by raising w07b-web's memory.max to 32M or more.

    PAGER 11:20, 'the server is slow': a zombie storm, a report job hogging the CPU, and a web app the OOM killer keeps shooting. Fix each the right way: no kill -9 first, and the report must finish.

    ▶ Play: BOSS: The slow serverSOLUTION HIDDEN90 XP

World 12System & Services

16 levels

Where the machine wakes: kernel, init, daemons, packages, modules. (This lab boots with busybox init, not systemd/OpenRC; apk is offline.)

  1. 156

    Level 156: The kernel's diary

    GuidedEasy

    Objective: Read the kernel's boot messages and tell Kern which Linux version booted: kern <version>.

    From the first microsecond of boot, the kernel writes its own diary, and dmesg reads it out loud. On this machine it's root-only, so you'll need sudo.

    Commands taughtkerneldmesg

    ▶ Play: The kernel's diarySOLUTION HIDDEN15 XP
  2. 157

    Level 157: What the bootloader whispered

    GuidedEasy

    Objective: Save the value of console= from the kernel command line into ~/console.txt.

    Before the kernel starts, the bootloader hands it a line of options, and the kernel keeps a copy in /proc/cmdline. console= says where it talks.

    Commands taughtkernel-cmdline

    ▶ Play: What the bootloader whisperedSOLUTION HIDDEN18 XP
  3. 158

    Level 158: PID 1

    GuidedEasy

    Objective: Find the script init runs at sysinit and tell Kern its path: kern <path>.

    The first program the kernel starts is init, and it gets PID 1. On this machine busybox init reads /etc/inittab to learn what to run at boot and what to respawn.

    Commands taughtinit

    ▶ Play: PID 1SOLUTION HIDDEN18 XP
  4. 159

    Level 159: The clock tower

    GuidedEasy

    Objective: Root's crontab holds Kern's chores: find the job that runs every Monday at 03:00 and tell Kern its name.

    A crontab line starts with five time fields: minute, hour, day of month, month, day of week, and * means every. So 30 4 * * 0 runs at 04:30 every Sunday (0 is Sunday, 1 is Monday).

    ▶ Play: The clock towerSOLUTION HIDDEN18 XP
  5. 160

    Level 160: logread: the system log

    GuidedEasy

    Objective: Learn logread and logger on the system log, then pull out the bell lines alone.

    Daemons have no screen, so they write to the system log instead. On Alpine, logread prints it and logger adds a line to it.

    Commands taughtsyslog

    ▶ Play: logread: the system logSOLUTION HIDDEN10 XP
  6. 161

    Level 161: Crash loop

    AloneMedium

    Objective: kern-heartbeatd keeps crashing and respawning: find why in the system log and fix it.

    A daemon is a program that runs in the background with no terminal, so it writes its complaints to the system log instead. On busybox systems logread shows that log.

    Commands taughtsyslogdaemons

    ▶ Play: Crash loopSOLUTION HIDDEN25 XP
  7. 162

    Level 162: apk info: whose file is it?

    GuidedEasy

    Objective: Learn apk info and apk info -W, then find a file's owner alone.

    Every program Alpine installs belongs to a package. apk info lists the packages, and apk info -W FILE names the package that owns a file.

    Commands taughtapk

    ▶ Play: apk info: whose file is it?SOLUTION HIDDEN10 XP
  8. 163

    Level 163: Whose file is this?

    AloneMedium

    Objective: One program listed in ~/suspects.txt doesn't come from any package: tell Kern its name.

    apk is Alpine's package manager: it remembers every file each package installed. apk info -W <file> names the owner, and a binary nobody owns deserves suspicion.

    Commands taughtapk

    ▶ Play: Whose file is this?SOLUTION HIDDEN25 XP
  9. 164

    Level 164: Inventory

    AloneMedium

    Objective: Write the number of installed packages into ~/pkgcount.txt.

    apk info with no arguments lists every installed package, one per line. Counting lines is a job for wc -l.

    ▶ Play: InventorySOLUTION HIDDEN22 XP
  10. 165

    Level 165: Weekly chores

    AloneMedium

    Objective: Schedule ~/bin/report.sh to run every Monday at 03:00 in your crontab.

    Your own jobs go in your crontab: one line, five time fields, then the command with its full path.

    ▶ Play: Weekly choresSOLUTION HIDDEN25 XP
  11. 166

    Level 166: lsmod and modprobe

    GuidedEasy

    Objective: Learn lsmod, modprobe and modprobe -r with the harmless dummy module, then load it alone.

    Drivers are kernel modules: pieces you can plug into the running kernel. lsmod lists the loaded ones, modprobe loads one, modprobe -r unloads it.

    ▶ Play: lsmod and modprobeSOLUTION HIDDEN10 XP
  12. 167

    Level 167: Load the driver

    Alone⏱ TimedHard

    Objective: Kern's network lab needs the dummy driver: load the kernel module dummy.

    Drivers can live outside the kernel as modules you plug in while it runs. lsmod lists loaded ones, modinfo describes one, modprobe loads it (root only).

    Commands taughtkernel-modules

    ▶ Play: Load the driverSOLUTION HIDDEN35 XP
  13. 168

    Level 168: uname: which kernel?

    GuidedEasy

    Objective: Learn uname, -r, -m and -a, then save the kernel release alone.

    uname prints facts about the running kernel. Every bug report starts with its release, uname -r.

    ▶ Play: uname: which kernel?SOLUTION HIDDEN10 XP
  14. 169

    Level 169: The vendor's bug report

    Alone⏱ TimedHard

    Objective: The vendor wants ~/bugreport.txt filled in before they'll look at Kern's crash: fill in every value.

    Support always asks the same questions: which kernel, which boot options, what's installed, what the kernel said. You know where every answer lives.

    ▶ Play: The vendor's bug reportSOLUTION HIDDEN40 XP
  15. 170

    Level 170: ss: who is listening?

    GuidedEasy

    Objective: Learn ss -t, -l, -n and -p on two lab listeners, then name the PID on port 7272 alone.

    A server program waits on a port. ss lists those sockets: -t TCP, -l listening ones, -n numbers, -p the program behind each (root only).

    Commands taughtss

    ▶ Play: ss: who is listening?SOLUTION HIDDEN10 XP
  16. 171

    Level 171: BOSS: The watchdog won't wake

    Boss⏱ TimedHard

    Objective: kern-watchd won't start: find out why, clear the way, then start it with hidden.

    Services start from scripts in /etc/init.d: sudo /etc/init.d/NAME start, stop or status. If the log says 'address already in use', another program holds its port (the numbered door network programs listen on): ps aux or hidden names it.

    Commands taughtservices

    ▶ Play: BOSS: The watchdog won't wakeSOLUTION HIDDEN60 XP

World 13Packages for Real

15 levels

The castle shop: repos, installs, upgrades, pins and tamper checks, plus an apt/dnf phrasebook. (Offline: a local signed repo in /srv/apk/ptr.)

  1. 172

    Level 172: Where packages come from

    GuidedEasy

    Objective: Make /etc/apk/repositories list only the local repo /srv/apk/ptr (this lab has no internet).

    apk downloads packages from the repositories listed in /etc/apk/repositories, one URL or folder per line; a line starting with # is ignored. Mirrors you can't reach make every apk command slow and noisy.

    Commands taughtapk-repositories

    ▶ Play: Where packages come fromSOLUTION HIDDEN16 XP
  2. 173

    Level 173: Fresh index

    GuidedEasy

    Objective: The warehouse got new stock: refresh apk's index and tell Kern how many distinct packages are available.

    apk update downloads each repository's index: the list of every package and version it offers. It installs nothing; it only refreshes what apk knows.

    Commands taughtapk-update

    ▶ Play: Fresh indexSOLUTION HIDDEN16 XP
  3. 174

    Level 174: First install

    GuidedEasy

    Objective: Install tmux from the local repo.

    apk add NAME installs a package plus everything it depends on, and writes NAME into /etc/apk/world, apk's list of what you asked for. Installing changes the system, so it needs root.

    Commands taughtapk-add

    ▶ Play: First installSOLUTION HIDDEN18 XP
  4. 175

    Level 175: apk search: window shopping

    GuidedEasy

    Objective: Learn apk search, -v and -d on the local repo, then find and install the greeting package alone.

    apk search looks through the repo's index for packages by name. -v adds versions and descriptions, -d searches the descriptions too.

    ▶ Play: apk search: window shoppingSOLUTION HIDDEN10 XP
  5. 176

    Level 176: Window shopping

    AloneMedium

    Objective: Find the text-based disk usage viewer in the repo and install it.

    apk search WORD finds packages by name, and apk search -d WORD also searches their descriptions; apk info -d NAME prints one package's description.

    Commands taughtapk-search

    ▶ Play: Window shoppingSOLUTION HIDDEN24 XP
  6. 177

    Level 177: apk info -e and apk del

    GuidedEasy

    Objective: Learn apk info -e and apk del on three installed packages, then remove one alone.

    apk info -e NAME prints the name if that package is installed, and nothing if not. sudo apk del NAME removes a package.

    ▶ Play: apk info -e and apk delSOLUTION HIDDEN10 XP
  7. 178

    Level 178: Tidy shelves

    AloneMedium

    Objective: Remove tmux and figlet, but keep ncdu.

    apk del NAME removes a package and its dependencies that nothing else needs any more. It also takes NAME out of /etc/apk/world.

    Commands taughtapk-del

    ▶ Play: Tidy shelvesSOLUTION HIDDEN24 XP
  8. 179

    Level 179: apk version and upgrade

    GuidedEasy

    Objective: Meet ptr-greet, see it is out of date, then upgrade it alone.

    apk version compares what you installed with the repo. -l '<' keeps only the older ones. apk upgrade installs the newer versions.

    ▶ Play: apk version and upgradeSOLUTION HIDDEN10 XP
  9. 180

    Level 180: Patch day

    AloneMedium

    Objective: Find which installed package is out of date, then upgrade the system.

    hidden lists installed packages that are older than the repo (apk list --upgradable too); apk upgrade installs every newer version.

    Commands taughtapk-upgrade

    ▶ Play: Patch daySOLUTION HIDDEN26 XP
  10. 181

    Level 181: apk policy and pins

    GuidedEasy

    Objective: Learn apk policy and a version pin, then read figlet's installed version alone.

    apk policy NAME lists every version the repos offer and which one is installed. NAME=VERSION in apk add pins one exact version.

    ▶ Play: apk policy and pinsSOLUTION HIDDEN10 XP
  11. 182

    Level 182: Hold that version

    AloneMedium

    Objective: ptr-greet 1.1 broke Kern's greeter: go back to 1.0 and pin it there so upgrades leave it alone.

    apk add NAME=VERSION installs that exact version and pins it in /etc/apk/world, so apk upgrade won't move it; apk policy NAME lists the versions on offer.

    Commands taughtapk-pin

    ▶ Play: Hold that versionSOLUTION HIDDEN26 XP
  12. 183

    Level 183: apk audit and apk fix

    GuidedEasy

    Objective: Find a tampered figlet file and fix it, then repair ptr-greet alone.

    apk remembers a checksum for every file it installs. apk audit --system DIR lists the package files that changed; apk fix NAME reinstalls the originals.

    ▶ Play: apk audit and apk fixSOLUTION HIDDEN10 XP
  13. 184

    Level 184: Tampered goods

    Alone⏱ TimedHard

    Objective: Someone edited a file that figlet installed: find it, then put the original back.

    apk remembers a checksum for every file it installed: apk audit --system DIR lists files that changed (U = updated), and apk fix NAME reinstalls a package's files.

    Commands taughtapk-audit

    ▶ Play: Tampered goodsSOLUTION HIDDEN38 XP
  14. 185

    Level 185: The phrasebook

    Alone⏱ TimedHard

    Objective: Translate five package jobs in a row for Alpine, Debian and RHEL boxes.

    Debian-family boxes use apt (repos) and dpkg (single files); the RHEL family uses dnf, called yum on old releases, and rpm. Same jobs as apk, different words.

    Commands taughtpkg-translate

    ▶ Play: The phrasebookSOLUTION HIDDEN40 XP
  15. 186

    Level 186: BOSS: Patch the box

    Boss⏱ TimedHard

    Objective: Security advisory in ~/advisory.txt: patch ptr-greet on this box and make sure the greeter service runs the fixed version.

    Patching is a loop: reach the repos, refresh, find what's outdated, upgrade, then restart whatever runs the old code. A pin in /etc/apk/world silently stops apk upgrade.

    Commands taughtpatching

    ▶ Play: BOSS: Patch the boxSOLUTION HIDDEN70 XP

World 14systemd: Services

12 levels

The init system on every real job: start, stop, enable, read the journal. (SIM: ptrd stands in for systemd; the commands are the real ones.)

  1. 187

    Level 187: Read the status card

    GuidedEasy

    Objective: foghorn went silent: read its status and tell Kern the exit status it died with (kern <number>).

    systemd runs nearly every real server (here ptrd, a simulator, plays it; the commands are real). systemctl status NAME is a service's ID card: the dot (● running, × failed), the Active: line, the Main PID, and its last log lines.

    Commands taughtptrdsystemctl

    ▶ Play: Read the status cardSOLUTION HIDDEN20 XP
  2. 188

    Level 188: start, stop, restart: try them

    GuidedEasy

    Objective: Try start, status, restart, is-active and stop on buoy and bell, then bring bell back alone.

    Three verbs run a service's life: start, stop, restart. They change the system, so they need sudo; reading with status does not.

    ▶ Play: start, stop, restart: try themSOLUTION HIDDEN10 XP
  3. 189

    Level 189: Start, stop, restart

    GuidedEasy

    Objective: Night shift: start beacon, stop the noisy drill, and restart lantern.

    sudo systemctl start NAME runs a service now, stop ends it, restart stops and starts it (a new Main PID). Changing services needs root; reading them does not.

    ▶ Play: Start, stop, restartSOLUTION HIDDEN25 XP
  4. 190

    Level 190: enable and disable: try them

    GuidedEasy

    Objective: Try is-enabled, disable, enable and enable --now on bell and buoy, then disable buoy alone.

    start is for now, enable is for every boot. disable removes the boot link and leaves the service running; enable --now does both at once.

    ▶ Play: enable and disable: try themSOLUTION HIDDEN10 XP
  5. 191

    Level 191: Survive the night (enable)

    GuidedEasy

    Objective: beacon must run now and after every reboot; tide must stop starting at boot.

    start is for now; enable is for every boot (it links the unit into multi-user.target). enable --now does both. disable removes the boot link but leaves it running. Check with systemctl is-enabled NAME.

    ▶ Play: Survive the night (enable)SOLUTION HIDDEN30 XP
  6. 192

    Level 192: Failed units: reset-failed

    GuidedEasy

    Objective: Find the failed units, clear pump's mark, then clear crane's alone.

    A service that crashes stays marked failed until you clear the mark. hidden lists them; reset-failed NAME clears one (it fixes nothing by itself).

    ▶ Play: Failed units: reset-failedSOLUTION HIDDEN10 XP
  7. 193

    Level 193: Who is red?

    GuidedEasy

    Objective: Find the failed unit, tell Kern its name, then clear its failed state.

    hidden (short: hidden) lists every unit in the failed state. After you read why, reset-failed NAME clears the red mark (it does not fix anything by itself).

    ▶ Play: Who is red?SOLUTION HIDDEN25 XP
  8. 194

    Level 194: The harbor's logbook

    GuidedEasy

    Objective: Read ferry's log with journalctl and tell Kern its boarding code: kern <code>.

    Everything services print lands in the journal. journalctl -u NAME shows one unit's lines, -n 20 only the last 20. Reading other services' logs needs root (on Debian/RHEL, or the adm / systemd-journal group).

    Commands taughtjournalctl

    ▶ Play: The harbor's logbookSOLUTION HIDDEN25 XP
  9. 195

    Level 195: journalctl: -p and -b

    GuidedEasy

    Objective: Filter the journal by priority and by boot, then find kiln's error code alone.

    Every journal line has a priority, from emerg and err down to info and debug. -p PRIO keeps that level and worse; -b keeps only this boot.

    ▶ Play: journalctl: -p and -bSOLUTION HIDDEN10 XP
  10. 196

    Level 196: Only the errors

    AloneMedium

    Objective: One unit logged an error this boot among tons of chatter: tell Kern the block number it complains about.

    Each journal line has a priority, from 0 emerg through 3 err and 4 warning to 7 debug. journalctl -p err shows err and worse and -b only this boot: together, the first command of most outages.

    ▶ Play: Only the errorsSOLUTION HIDDEN30 XP
  11. 197

    Level 197: Shift change

    Alone⏱ TimedHard

    Objective: Handover: beacon on (now and at boot), drill off (now and at boot), and winch's failed mark cleared.

    Shift handover list: everything at once, and it must still be true after a reboot.

    ▶ Play: Shift changeSOLUTION HIDDEN40 XP
  12. 198

    Level 198: BOSS: Harbor blackout

    Boss⏱ TimedHard

    Objective: Get lantern running (fix what its log names), make lantern and foghorn start at boot, and silence drill for good.

    PAGER 03:12: the harbor is dark. lantern is failed, foghorn runs but would not come back after a reboot, and drill is blaring. Fix the cause, not the symptom, and make it survive a reboot.

    ▶ Play: BOSS: Harbor blackoutSOLUTION HIDDEN80 XP

World 15Units, Timers & Targets

9 levels

Write your own services, override them with drop-ins, schedule timers and survive a crash loop across a reboot. (SIM: ptrd.)

  1. 199

    Level 199: Write your first unit

    GuidedEasy

    Objective: Turn /usr/local/bin/tidegauge into a service, run it, then give it Environment=MODE=storm.

    A service is a small text file: [Unit] describes it, [Service] says what to run (ExecStart= with a full path), [Install] says which target wants it. Your own units live in /etc/systemd/system/NAME.service, and after editing one you run hidden.

    Commands taughtunit-files

    ▶ Play: Write your first unitSOLUTION HIDDEN30 XP
  2. 200

    Level 200: Get back up (Restart=)

    GuidedEasy

    Objective: buoyd crashes now and then: make systemd restart it by itself.

    Restart=on-failure makes systemd restart a service that crashes; RestartSec= waits between tries. Too many crashes in a row (StartLimitBurst in StartLimitIntervalSec) and systemd gives up: start-limit-hit.

    ▶ Play: Get back up (Restart=)SOLUTION HIDDEN30 XP
  3. 201

    Level 201: Override, never overwrite

    GuidedEasy

    Objective: Make radio listen on CHANNEL=16 with a drop-in, without touching radio.service itself.

    Unit files that came with a package get replaced on upgrade. Override them with a drop-in: sudo systemctl edit NAME writes NAME.service.d/override.conf, reloads, and keeps your change through upgrades. systemctl cat NAME shows the file plus its drop-ins.

    ▶ Play: Override, never overwriteSOLUTION HIDDEN30 XP
  4. 202

    Level 202: Choose the boot target

    GuidedEasy

    Objective: This server boots into graphical.target, but it has no screen: make it boot to multi-user.target.

    Targets are groups of units, like old runlevels: multi-user.target is a full text-mode server, graphical.target adds a desktop, rescue.target is single-user repair. get-default shows where the box boots; set-default changes it.

    Commands taughtsystemd-targets

    ▶ Play: Choose the boot targetSOLUTION HIDDEN30 XP
  5. 203

    Level 203: Timers (cron, the systemd way)

    GuidedEasy

    Objective: Run harbor-backup every night at 02:30 with a timer that is enabled and active.

    A .timer starts the .service of the same name: OnCalendar=*-*-* 02:30:00 means every day at 02:30, and Persistent=true catches up a run missed while the box was off. systemd-analyze calendar tests it, list-timers shows the next run (one-off job: echo cmd | at 02:30).

    Commands taughtsystemd-timers

    ▶ Play: Timers (cron, the systemd way)SOLUTION HIDDEN35 XP
  6. 204

    Level 204: A logbook that survives

    Alone⏱ TimedHard

    Objective: Make the journal survive reboots, so tomorrow you can still read today's crash.

    By default this journal lives in /run: a reboot wipes yesterday's evidence. Storage=persistent in /etc/systemd/journald.conf (or creating /var/log/journal) keeps it on disk; restart systemd-journald to apply. journalctl --list-boots then shows every boot.

    Commands taughtjournald-storage

    ▶ Play: A logbook that survivesSOLUTION HIDDEN35 XP
  7. 205

    Level 205: Ticket: signal, 4 minutes

    Alone⏱ TimedHard

    Objective: Give signal Restart=on-failure with a drop-in, run it now and at every boot, and make the box boot to multi-user.target.

    Ticket: the harbor-signal package shipped a unit without self-healing, on a headless box that boots a desktop. Fix it the upgrade-proof way, and it must all come back after a reboot.

    ▶ Play: Ticket: signal, 4 minutesSOLUTION HIDDEN45 XP
  8. 206

    Level 206: list-units: filter by type

    GuidedEasy

    Objective: Learn list-units with --type and --state, then save the running services list alone.

    systemctl list-units lists every unit in memory: services, targets, timers, all mixed. --type= keeps one kind, --state= keeps one state.

    ▶ Play: list-units: filter by typeSOLUTION HIDDEN10 XP
  9. 207

    Level 207: BOSS: The crash loop

    Boss⏱ TimedHard

    Objective: Get harbor-web serving on port 8080, at boot too: fix its unit, free the port for good, and bring it up.

    PAGER 04:40: harbor-web restarts over and over and never serves, with three faults behind one red dot. Read status and the journal, fix them one by one, and the fix must survive a reboot.

    ▶ Play: BOSS: The crash loopSOLUTION HIDDEN90 XP

World 16Storage

16 levels

The disk vaults: partitions, space, inodes, mounts, archives and the dreaded 100%. (No real disks here: partition tables live in image files.)

  1. 208

    Level 208: How full is the vault?

    GuidedEasy

    Objective: Tell Kern how full /mnt/vault is, in percent (df -h shows it): kern <number>.

    df shows every mounted filesystem with its size, used space and Use%. Add -h and the numbers become human: K, M, G.

    Commands taughtdf

    ▶ Play: How full is the vault?SOLUTION HIDDEN15 XP
  2. 209

    Level 209: Who ate the disk?

    GuidedEasy

    Objective: Something in /mnt/vault is hogging space: weigh its folders with du and tell Kern which folder is biggest.

    df tells you a disk is full; du tells you who filled it. du -sh <dir> sums one folder, and sort -h orders human sizes.

    Commands taughtdu

    ▶ Play: Who ate the disk?SOLUTION HIDDEN18 XP
  3. 210

    Level 210: The partition map

    GuidedEasy

    Objective: Read the map of the old disk image ~/attic/old-disk.img with fdisk -l (lsblk lists real disks): kern <start sector of its Linux partition>.

    A disk starts with a partition table that cuts it into partitions (sda1, sda2…), and lsblk or /proc/partitions list a machine's real ones. fdisk -l reads that table from a disk, or from a disk image file: this lab has no real disks, only images.

    Commands taughtpartitions

    ▶ Play: The partition mapSOLUTION HIDDEN18 XP
  4. 211

    Level 211: df -i: counting the slots

    GuidedEasy

    Objective: Learn df -i on the tiny /mnt/vault disk, then read its inode use alone.

    Every file takes one inode, a numbered slot. A disk can run out of slots while it still has bytes left.

    ▶ Play: df -i: counting the slotsSOLUTION HIDDEN10 XP
  5. 212

    Level 212: Plenty of space, no room

    AloneMedium

    Objective: Kern can't create /mnt/spool/kern.note even though df -h shows free space: make room and create it.

    Every file costs one inode, a slot in the filesystem's table, however small it is. Run out of inodes and you can't create files even with gigabytes free: df -i counts them.

    ▶ Play: Plenty of space, no roomSOLUTION HIDDEN25 XP
  6. 213

    Level 213: Pack it up

    AloneMedium

    Objective: Back up the whole ~/projects folder into ~/projects.tar.gz.

    tar glues many files into one archive and gzip squeezes it: tar czf out.tar.gz dir does both. c = create, z = gzip, f = the file name that follows.

    Commands taughttarcompression

    ▶ Play: Pack it upSOLUTION HIDDEN22 XP
  7. 214

    Level 214: tar: unpacking, one file at a time

    GuidedEasy

    Objective: Learn tar t, x, J and -C on ~/lab/tar/camp.tar.xz, then pull one file out alone.

    Packing is half the job. Today we unpack: everything, into another folder, or one single file out of a big archive.

    ▶ Play: tar: unpacking, one file at a timeSOLUTION HIDDEN10 XP
  8. 215

    Level 215: Restore just one file

    AloneMedium

    Objective: Kern's config got wiped: pull only kern-vault/notes/kern.cfg out of ~/vault.tar.xz.

    tar t lists an archive without opening it, and tar x extracts; name a member after the archive to extract only that one. J means xz compression.

    ▶ Play: Restore just one fileSOLUTION HIDDEN25 XP
  9. 216

    Level 216: mount: plug a filesystem in

    GuidedEasy

    Objective: Learn mount -t / -o and umount with a small tmpfs, then mount one alone.

    A folder becomes a door to another filesystem when you mount one on it. tmpfs is a filesystem that lives in RAM.

    Commands taughtmount

    ▶ Play: mount: plug a filesystem inSOLUTION HIDDEN10 XP
  10. 217

    Level 217: A disk made of RAM

    AloneMedium

    Objective: Give Kern a 2 MB RAM disk: mount a tmpfs of size 2m on /mnt/scratch.

    mount attaches a filesystem to a folder, the mount point; umount detaches it. tmpfs is a filesystem that lives in RAM: mount -t tmpfs -o size=… tmpfs <dir>.

    Commands taughtmount

    ▶ Play: A disk made of RAMSOLUTION HIDDEN25 XP
  11. 218

    Level 218: The old memory card

    AloneMedium

    Objective: Mount Kern's old card image ~/finds/sdcard.img on /mnt/card, tell Kern the word in its note.txt, then unmount it.

    A disk image holds a whole filesystem, and mount -o loop turns the file into a pretend disk (/dev/loop0) that mounts like a real one. umount <dir> detaches it when you're done.

    Commands taughtloop-devices

    ▶ Play: The old memory cardSOLUTION HIDDEN25 XP
  12. 219

    Level 219: A disk made of a file

    GuidedEasy

    Objective: Learn truncate -s and mkfs.ext4 -q in ~/lab/disk, then build a disk image alone.

    A disk is just a long row of bytes, and so is a file. Give a file a size and a filesystem, and it is a disk.

    Commands taughtmkfs

    ▶ Play: A disk made of a fileSOLUTION HIDDEN10 XP
  13. 220

    Level 220: A disk in a file

    Alone⏱ TimedHard

    Objective: Make a 16 MB ~/disk.img, format it as ext4, mount it on /mnt/data, create hello.txt inside it, then unmount it.

    mkfs.ext4 writes a fresh, empty filesystem onto a disk, or onto a file of the right size. After that it's the old card again: mount -o loop, use it, umount so everything is safely written.

    Commands taughtmkfsfile

    ▶ Play: A disk in a fileSOLUTION HIDDEN35 XP
  14. 221

    Level 221: Disk rescue

    Alone⏱ TimedHard

    Objective: Unpack ~/disks.tar.gz onto a fresh 8 MB tmpfs at /mnt/rescue, then archive only the image with a Linux partition into ~/linux-disk.tar.gz.

    Rescue work is all the tools at once: a scratch RAM disk, an archive to unpack, a partition table to read and a new archive to keep.

    ▶ Play: Disk rescueSOLUTION HIDDEN40 XP
  15. 222

    Level 222: Where did the space go?

    GuidedEasy

    Objective: Learn du -a, the biggest-files pipe and lsof +L1 on /mnt/logs, then free its hidden space alone.

    du adds up the files you can see. df counts the whole disk, including deleted files a program still holds open.

    Commands taughtlsof

    ▶ Play: Where did the space go?SOLUTION HIDDEN10 XP
  16. 223

    Level 223: BOSS: Disk full

    Boss⏱ TimedHard

    Objective: /mnt/data is full: get it below 25% use without deleting important.db.

    Deleting a file only frees its space once no process holds it open. hidden lists files that are deleted but still open, and which process holds each one.

    Commands taughtdeleted-fileslsof

    ▶ Play: BOSS: Disk fullSOLUTION HIDDEN65 XP

World 17Disks for Real

15 levels

The loading dock: new disks get partitioned, formatted, named and written into /etc/fstab to survive reboots. (Disks here are loop devices.)

  1. 224

    Level 224: A new disk arrives

    GuidedEasy

    Objective: The delivery van left a disk image at /tmp/delivery/crate.img: plug it in and see it appear in lsblk.

    On a real server a new disk just appears as /dev/sdb or /dev/vdb when someone plugs it in. In this lab disks arrive as image files: sudo losetup -f --show FILE plugs one into the first free loop device and prints its name.

    Commands taughtlosetup

    ▶ Play: A new disk arrivesSOLUTION HIDDEN14 XP
  2. 225

    Level 225: Who's who

    GuidedEasy

    Objective: Ask hidden or blkid which of the three plugged-in disks holds the filesystem labelled ARCHIVE, then tell Kern: kern loopN.

    hidden adds what is ON each disk: filesystem type, label and UUID. hidden prints the same tags; a disk with no FSTYPE is blank.

    Commands taughtblkid

    ▶ Play: Who's whoSOLUTION HIDDEN15 XP
  3. 226

    Level 226: Slice it up

    GuidedEasy

    Objective: Give the new blank 24 MB disk a GPT table with one Linux partition that fills it.

    A partition table splits a disk into slices; GPT is the modern kind. sudo sgdisk -p DISK prints the table and sgdisk -n 1:0:0 DISK makes partition 1 from the first free sector (0) to the end (0).

    Commands taughtgpt

    ▶ Play: Slice it upSOLUTION HIDDEN18 XP
  4. 227

    Level 227: Name tags

    GuidedEasy

    Objective: Label the spare ext4 disk BACKUP, then tell Kern the first 8 characters of its UUID.

    Device names can change between boots, so admins point at a filesystem by its LABEL (a name you choose) or its UUID (a random ID set by mkfs). sudo e2label DEV NAME sets an ext4 label; hidden DEV shows both.

    Commands taughtlabels-uuid

    ▶ Play: Name tagsSOLUTION HIDDEN16 XP
  5. 228

    Level 228: Move-in day

    AloneMedium

    Objective: The new disk already has one partition: put ext4 on that partition and mount it on /srv/data.

    A partition is just space until mkfs puts a filesystem on it; then mount hangs it on a folder. Format the partition (…p1), never the whole disk, or the partition table is gone.

    ▶ Play: Move-in daySOLUTION HIDDEN24 XP
  6. 229

    Level 229: Who is using that disk?

    GuidedEasy

    Objective: Learn fuser -m and -v on /srv/new, then free it and unmount it alone.

    Linux refuses to unmount a disk while a program works on it: target is busy. fuser names the culprits.

    Commands taughtfuser

    ▶ Play: Who is using that disk?SOLUTION HIDDEN10 XP
  7. 230

    Level 230: Target is busy

    AloneMedium

    Objective: Unplug the disk mounted on /srv/data: unmount it, after finding out who keeps it busy.

    umount refuses while anything still uses the mount: a program with a file open, or a shell standing inside it (yours counts!). sudo fuser -vm DIR lists the culprits; lsof DIR works too.

    Commands taughtfuser

    ▶ Play: Target is busySOLUTION HIDDEN26 XP
  8. 231

    Level 231: fstab: mounts that come back

    GuidedEasy

    Objective: Learn tee -a, an fstab line and mount -a, then add one for the SPARE disk alone.

    /etc/fstab lists what to mount at every boot, one line per disk. hidden reads it now, so you test before rebooting.

    Commands taughtfstab

    ▶ Play: fstab: mounts that come backSOLUTION HIDDEN10 XP
  9. 232

    Level 232: Mount at every boot

    AloneMedium

    Objective: Make the DATA disk mount on /srv/data at every boot, and prove it survives a reboot.

    mount is forgotten at reboot; /etc/fstab is read at every boot. One line per filesystem: WHAT WHERE TYPE OPTIONS 0 2, with WHAT as LABEL= or UUID=, and nofail so a missing disk never stops the boot.

    Commands taughtfstab

    ▶ Play: Mount at every bootSOLUTION HIDDEN28 XP
  10. 233

    Level 233: Swap: spare memory on disk

    GuidedEasy

    Objective: Learn mkswap, swapon and swapoff on /dev/loop0, then switch on a second swap alone.

    When RAM is full, Linux parks unused memory pages in swap, a disk area set aside for that. Slow, but better than crashing.

    Commands taughtswap

    ▶ Play: Swap: spare memory on diskSOLUTION HIDDEN10 XP
  11. 234

    Level 234: Swap at every boot

    GuidedEasy

    Objective: Learn the fstab swap line and swapon -a with PRACTICE, then do the same for SPARE alone.

    swapon lasts until the next reboot. An fstab line brings swap back every time, and swapon -a tests it right now.

    ▶ Play: Swap at every bootSOLUTION HIDDEN10 XP
  12. 235

    Level 235: Room to breathe

    AloneMedium

    Objective: The box runs out of RAM at night: make the spare 16 MB disk swap, now and at every boot.

    Swap is disk space the kernel uses as spare RAM. sudo mkswap DEV writes a swap signature, sudo swapon DEV turns it on now, and an fstab line of type swap (mount point none) turns it on at every boot.

    Commands taughtswap

    ▶ Play: Room to breatheSOLUTION HIDDEN28 XP
  13. 236

    Level 236: One disk, three filesystems

    GuidedEasy

    Objective: Format /dev/loop0 three ways, reading blkid in between, then make /dev/loop1 XFS alone.

    ext4 is Debian's default, XFS is Red Hat's, vfat is what cameras and USB sticks speak. Each has its own mkfs and label flag.

    Commands taughtxfs-vfat

    ▶ Play: One disk, three filesystemsSOLUTION HIDDEN10 XP
  14. 237

    Level 237: Camera day

    Alone⏱ TimedHard

    Objective: Reformat the disk on /srv/media as XFS and mount it back, then plug in /tmp/delivery/card.img and format it vfat with label CAMERA.

    Each filesystem has its own mkfs: mkfs.xfs (RHEL's default, -f to overwrite an old one) and mkfs.vfat (cameras and USB sticks, -n sets the label).

    Commands taughtxfs-vfat

    ▶ Play: Camera daySOLUTION HIDDEN42 XP
  15. 238

    Level 238: BOSS: The 3 a.m. fstab

    Boss⏱ TimedHard

    Objective: At 3 a.m. mount -a fails: fix /etc/fstab, then put the new disk on /srv/data at every boot (GPT, ext4 labelled DATA) and survive a reboot.

    A broken fstab line is how servers fail to boot: hidden and hidden test it safely, and their errors name the bad line. Fix, test, then let the reboot be the judge.

    ▶ Play: BOSS: The 3 a.m. fstabSOLUTION HIDDEN70 XP

World 18LVM & Repair

10 levels

Disks melt into pools: repair broken filesystems, grow them online, build LVM volumes that survive 3 a.m. and a reboot. (Disks are loop devices.)

  1. 239

    Level 239: The scratched disk

    GuidedEasy

    Objective: The rescue disk (rescue.img) won't mount: repair it with e2fsck and mount it at /mnt/rescue.

    A filesystem can get damaged by a crash or a yanked cable, and then mount refuses it. e2fsck checks and repairs ext2/3/4 (-f full check, -y yes to every fix), but only while the filesystem is unmounted.

    Commands taughtfsck

    ▶ Play: The scratched diskSOLUTION HIDDEN16 XP
  2. 240

    Level 240: The shop grows

    GuidedEasy

    Objective: Get more room on /srv/shop: shrink the root reserve, label it, then grow it onto the bigger disk.

    tune2fs changes an ext4 filesystem's settings in place: -m sets the % kept for root only, -L a label. When the disk under a filesystem grows, the kernel must notice first, then resize2fs stretches the filesystem, even while mounted.

    Commands taughttune2fsresize2fs

    ▶ Play: The shop growsSOLUTION HIDDEN20 XP
  3. 241

    Level 241: Your first volume group

    GuidedEasy

    Objective: Turn the new disk (spare.img) into a volume group vgshop with a 12 MB volume web, formatted ext4 and mounted at /srv/web.

    LVM puts a layer between disks and filesystems: disks become physical volumes (PV), PVs pool into a volume group (VG), and you carve logical volumes (LV) out of the pool. An LV is a device like any disk: mkfs it, mount it, and later grow it across disks.

    Commands taughtlvm

    ▶ Play: Your first volume groupSOLUTION HIDDEN22 XP
  4. 242

    Level 242: LVM: stretching a volume

    GuidedEasy

    Objective: Learn lvextend -L, -r and vgextend on vglab, then grow vglab/data alone.

    An LV is a slice of its VG's pool. Growing it takes two layers: the LV itself, then the filesystem inside it.

    Commands taughtlvextend

    ▶ Play: LVM: stretching a volumeSOLUTION HIDDEN10 XP
  5. 243

    Level 243: Stretch /srv/web

    AloneMedium

    Objective: /srv/web is 100% full: give it 8 MB more without unmounting it.

    lvextend -L +SIZE grows a logical volume from the VG's free space; -r grows the filesystem inside in the same breath. ext4 and XFS can both grow while mounted.

    Commands taughtlvextend

    ▶ Play: Stretch /srv/webSOLUTION HIDDEN26 XP
  6. 244

    Level 244: LVM: a photo of a volume

    GuidedEasy

    Objective: Learn lvcreate -s, a read-only mount and lvremove -y on vglab, then take a snapshot alone.

    A snapshot freezes an LV as it is right now. It only stores the blocks that change afterwards, so it needs little room.

    Commands taughtlvm-snapshot

    ▶ Play: LVM: a photo of a volumeSOLUTION HIDDEN10 XP
  7. 245

    Level 245: A photo of the database

    AloneMedium

    Objective: Back up the busy /srv/db consistently: snapshot it, archive the snapshot to ~/db-backup.tar.gz, then clean up.

    An LVM snapshot (lvcreate -s) freezes an LV at one instant while the original keeps running: back up the frozen copy, then remove it. It only needs room for the blocks that change meanwhile, and a snapshot that runs out of room breaks.

    Commands taughtlvm-snapshot

    ▶ Play: A photo of the databaseSOLUTION HIDDEN28 XP
  8. 246

    Level 246: A disk for /srv/data

    Alone⏱ TimedHard

    Objective: A new disk (spare.img) arrived: put /srv/data on an LVM volume (any names, at least 8 MB), ext4 labeled DATA, mounted.

    The whole recipe, against the clock: pvcreate, vgcreate, lvcreate, mkfs, mount, and a label so fstab can find it later.

    ▶ Play: A disk for /srv/dataSOLUTION HIDDEN36 XP
  9. 247

    Level 247: Crashed and full

    Alone⏱ TimedHard

    Objective: Bring /srv/logs back: repair its filesystem, add the spare disk to vgapp, grow logs by 8 MB, mount it again.

    Real outages stack up: the logs volume crashed AND was full. Repair first, then add a disk to the VG with vgextend, then grow.

    ▶ Play: Crashed and fullSOLUTION HIDDEN40 XP
  10. 248

    Level 248: BOSS: 3 a.m., /srv/app is full

    Boss⏱ TimedHard

    Objective: Save /srv/app: add the spare disk, back it up from a snapshot, grow it by 8 MB, and make it mount at boot.

    The pager screams: /srv/app on vgprod is 100% full and the VG has no free space. Grow the pool, take a safety snapshot, grow the volume, and make sure it all comes back after a reboot.

    ▶ Play: BOSS: 3 a.m., /srv/app is fullSOLUTION HIDDEN70 XP

World 19Linux Networking

16 levels

Where machines talk: addresses, routes, names, ports, SSH and the web. (No internet here: server is a stub host on 127.0.0.2.)

  1. 249

    Level 249: The way out

    GuidedEasy

    Objective: Kern plugged in a new card, kern0: find its default gateway with ip addr and hidden, and tell Kern.

    ip addr lists each network card and its addresses; hidden shows where packets go. The default route points at the gateway, your network's door to everywhere else.

    Commands taughtip

    ▶ Play: The way outSOLUTION HIDDEN15 XP
  2. 250

    Level 250: Give it a name

    GuidedEasy

    Objective: Make the name kern.lan point to 127.0.0.9 so ping kern.lan works.

    Before asking DNS, Linux checks /etc/hosts: one line per address, followed by its names. The first line that lists a name wins.

    Commands taughthosts-filepingtee

    ▶ Play: Give it a nameSOLUTION HIDDEN18 XP
  3. 251

    Level 251: Grab it

    GuidedEasy

    Objective: Download http://127.0.0.1:8081/manual.txt into your ~/downloads folder with wget.

    curl prints what a server says; wget saves it straight into a file named after the URL. -P picks the folder, -O the file name.

    Commands taughtwgetcurl

    ▶ Play: Grab itSOLUTION HIDDEN18 XP
  4. 252

    Level 252: Raise the wall

    GuidedEasy

    Objective: Port 8080 is wide open: load the rules in /etc/nftables.nft with sudo nft -f, then prove with curl that 8080 no longer answers.

    The kernel's firewall is nftables: its live rules sit in the kernel, hidden shows them, and sudo nft -f FILE loads a rules file. A file nobody loaded protects nothing.

    Commands taughtfirewall

    ▶ Play: Raise the wallSOLUTION HIDDEN18 XP
  5. 253

    Level 253: dig: ask one DNS server

    GuidedEasy

    Objective: Ask the lab DNS server at 127.0.0.53 about some names, then look one up alone.

    dig asks a DNS server what address a name has. With @SERVER you pick the server yourself; +short keeps only the answer.

    Commands taughtdig

    ▶ Play: dig: ask one DNS serverSOLUTION HIDDEN10 XP
  6. 254

    Level 254: Ask the resolver

    AloneMedium

    Objective: dig vault.lan fails, but the lab DNS server at 127.0.0.53 knows it: fix /etc/resolv.conf.

    dig @server name asks one DNS server directly; plain dig name, and every other program, asks the nameserver in /etc/resolv.conf. Point that file at a dead server and every name dies.

    Commands taughtdnsdig

    ▶ Play: Ask the resolverSOLUTION HIDDEN25 XP
  7. 255

    Level 255: Who's listening?

    AloneMedium

    Objective: A secret web server is running on this machine: find its port, fetch its page and tell Kern the access code.

    ss -tln lists every TCP port a program is listening on; add -p to see which program (root sees all). curl fetches what a web server says.

    Commands taughtss

    ▶ Play: Who's listening?SOLUTION HIDDEN25 XP
  8. 256

    Level 256: SSH keys, step by step

    GuidedEasy

    Objective: Make a practice key pair in ~/lab/ssh, install it for server@server and log in with it.

    An SSH key pair is a private key you keep and a public .pub you hand out. ssh-keygen makes the pair, ssh-copy-id installs the .pub on a server.

    Commands taughtssh-keygen

    ▶ Play: SSH keys, step by stepSOLUTION HIDDEN10 XP
  9. 257

    Level 257: Keys, not passwords

    AloneMedium

    Objective: Set up key login: create a key pair and install your public key for server@server (its password is server).

    An SSH key pair is a private key that never leaves you and a public key you hand out. A server lets in anyone whose public key is in ~/.ssh/authorized_keys.

    Commands taughtsshssh-keygen

    ▶ Play: Keys, not passwordsSOLUTION HIDDEN30 XP
  10. 258

    Level 258: scp: copy over SSH

    GuidedEasy

    Objective: Send and fetch files between ~/lab/scp and server@server, then send one alone.

    scp copies files between machines over SSH, like cp: source first, then destination. user@host:path means a path on that machine.

    Commands taughtscp

    ▶ Play: scp: copy over SSHSOLUTION HIDDEN10 XP
  11. 259

    Level 259: Ship it

    Alone⏱ TimedHard

    Objective: Copy ~/report.txt into server's home folder with scp.

    scp copies files over SSH: scp <file> user@host:<path>. A path after the colon is relative to that user's home.

    Commands taughtscp

    ▶ Play: Ship itSOLUTION HIDDEN35 XP
  12. 260

    Level 260: The first match wins

    Alone⏱ TimedHard

    Objective: Kern's firewall drops web traffic on port 80: fix the rule in /etc/nftables.nft, load it, and keep every other rule.

    A chain walks its rules top to bottom and the first match decides: accept or drop. The kernel only learns about edits to /etc/nftables.nft when you load the file again with nft -f, and that file is also what loads at boot.

    ▶ Play: The first match winsSOLUTION HIDDEN35 XP
  13. 261

    Level 261: Configure a card by hand

    GuidedEasy

    Objective: Configure the practice card lab0, then configure lab1 alone.

    A blank network card needs an address, then to be switched on, then routes. ip addr add, ip link set ... up and hidden add do it (root only).

    ▶ Play: Configure a card by handSOLUTION HIDDEN10 XP
  14. 262

    Level 262: Back online

    Alone⏱ TimedHard

    Objective: kern0 came back from repair blank: configure it from ~/kern0.card, then wget the patch the card points to into your home.

    A card needs an address to be reachable and a default route to reach anything else. ip addr add, ip link set … up and hidden add do it (root only).

    ▶ Play: Back onlineSOLUTION HIDDEN40 XP
  15. 263

    Level 263: curl -I: just the headers

    GuidedEasy

    Objective: Read the headers of the lab web server on port 8090, then read one alone.

    Every web reply starts with headers: a status line (200 OK, 404 Not Found...) plus facts like the size. curl -I asks for the headers only.

    ▶ Play: curl -I: just the headersSOLUTION HIDDEN10 XP
  16. 264

    Level 264: BOSS: The website is down

    Boss⏱ TimedHard

    Objective: The website is down: get http://127.0.0.1/ serving Kern's homepage again.

    A web server needs three things: to run, to find its document root, and to be allowed to read the files in it.

    ▶ Play: BOSS: The website is downSOLUTION HIDDEN70 XP

World 20Crypto & Integrity

18 levels

Checksums, GPG, certificates and encrypted disks: prove a file is untouched and keep secrets secret.

  1. 265

    Level 265: Fingerprints of files

    GuidedEasy

    Objective: Find the firmware file that fails its published checksum, then fingerprint your own configs.

    sha256sum prints a file's fingerprint: change one byte and it changes completely. sha256sum -c LIST re-checks a list of fingerprints (OK / FAILED). MD5 and SHA-1 are broken: use SHA-256 or better.

    Commands taughtsha256sum

    ▶ Play: Fingerprints of filesSOLUTION HIDDEN25 XP
  2. 266

    Level 266: gpg without the pop-ups

    GuidedEasy

    Objective: Make a practice GPG key with no prompt, then make one alone.

    gpg --quick-gen-key makes a key pair in one line. Normally a pop-up asks for a passphrase; a few switches let a script (or this lab) skip it.

    Commands taughtgpg

    ▶ Play: gpg without the pop-upsSOLUTION HIDDEN10 XP
  3. 267

    Level 267: Your own seal (gpg)

    GuidedEasy

    Objective: Create your GPG key Kern <kern@harbor>, then sign release.tar with a detached signature.

    GPG gives you a key pair: the private key signs, the public key lets anyone verify. A detached signature (FILE.asc) proves who made FILE and that not one byte changed since.

    Commands taughtgpg

    ▶ Play: Your own seal (gpg)SOLUTION HIDDEN30 XP
  4. 268

    Level 268: Trust, but verify

    GuidedEasy

    Objective: Import the harbor master's key, find the tampered map, then encrypt your notes and delete the plaintext.

    Before you use a download, import its publisher's public key (gpg --import) and gpg --verify the signature: 'Good signature' or 'BAD signature'. gpg -e -r NAME encrypts for a key; gpg -d decrypts.

    ▶ Play: Trust, but verifySOLUTION HIDDEN30 XP
  5. 269

    Level 269: Forge a certificate

    GuidedEasy

    Objective: In ~/crypto, use openssl req -x509 to make harbor.key + harbor.crt: self-signed, valid 365 days, with SAN DNS:harbor.local.

    A TLS certificate binds a public key to names. openssl req -x509 makes a self-signed one plus its private key. Browsers match the subjectAltName (SAN), not the CN, so always add -addext 'subjectAltName=DNS:NAME'.

    Commands taughtopenssl

    ▶ Play: Forge a certificateSOLUTION HIDDEN30 XP
  6. 270

    Level 270: Reading a certificate

    GuidedEasy

    Objective: Read the name and dates of ~/lab/certs/lab.crt, then save a date alone.

    openssl x509 -in FILE -noout reads a certificate without the wall of text. Add what you want to see: -subject, -enddate, -dates.

    ▶ Play: Reading a certificateSOLUTION HIDDEN10 XP
  7. 271

    Level 271: When does it expire?

    AloneMedium

    Objective: Of the three certificates in /etc/ssl/harbor, which one expires first? kern <file>.

    openssl x509 -in FILE -noout -enddate (or -dates, -subject, -issuer, -ext subjectAltName) reads a cert without the wall of text. -checkend SECONDS answers 'still valid then?' by exit code.

    ▶ Play: When does it expire?SOLUTION HIDDEN25 XP
  8. 272

    Level 272: Knock on a TLS door

    GuidedEasy

    Objective: Connect to the lab TLS service on 127.0.0.1:9443 and verify it step by step, then check one alone.

    openssl s_client -connect HOST:PORT opens a TLS session and shows the server's certificate. -CAfile says which CA you trust, and Verify return code tells you if it checks out.

    ▶ Play: Knock on a TLS doorSOLUTION HIDDEN10 XP
  9. 273

    Level 273: Talk TLS by hand

    AloneMedium

    Objective: Connect to the TLS service on 127.0.0.1:8443, verify it against /etc/ssl/harbor/ca.crt, and tell Kern its organisation (O=).

    openssl s_client -connect HOST:PORT opens a TLS session and prints the server's certificate chain and 'Verify return code'. Give it -CAfile with the CA you trust and -verify_return_error so a bad cert stops the connection (never skip verification).

    ▶ Play: Talk TLS by handSOLUTION HIDDEN30 XP
  10. 274

    Level 274: The missing link

    Alone⏱ TimedHard

    Objective: Clients that trust only ca.crt fail on 127.0.0.1:8443: fix site.crt so the service sends the full chain, and restart it.

    Most certs are signed by an intermediate CA, not the root. The server must send its cert AND the intermediate (a 'full chain'), or clients fail with 'unable to get local issuer certificate'.

    ▶ Play: The missing linkSOLUTION HIDDEN40 XP
  11. 275

    Level 275: LUKS 1: lock a disk

    GuidedEasy

    Objective: Format the practice image ~/lab/luks/lab.img as LUKS, then format box.img alone.

    cryptsetup luksFormat turns a disk into an encrypted LUKS container, guarded by a passphrase. It wipes what was there, so it asks twice.

    Commands taughtcryptsetup

    ▶ Play: LUKS 1: lock a diskSOLUTION HIDDEN10 XP
  12. 276

    Level 276: LUKS 2: open, use, close

    GuidedEasy

    Objective: Unlock ~/lab/vault/old.img (passphrase sea), look inside, lock it, then read its note alone.

    cryptsetup open DISK NAME unlocks a LUKS disk as /dev/mapper/NAME: mount that like any disk. Unmount, then cryptsetup close NAME locks it again.

    ▶ Play: LUKS 2: open, use, closeSOLUTION HIDDEN10 XP
  13. 277

    Level 277: A vault on a disk (LUKS)

    Alone⏱ TimedHard

    Objective: Turn the spare disk vault.img into an encrypted vault with a file inside, then lock it again.

    LUKS encrypts a whole block device. luksFormat once, then cryptsetup open DEV NAME gives a clear /dev/mapper/NAME to mkfs and mount; close locks it again. (The lab uses a weak KDF for speed; real boxes keep the default argon2id.)

    Commands taughtcryptsetup

    ▶ Play: A vault on a disk (LUKS)SOLUTION HIDDEN45 XP
  14. 278

    Level 278: Immutable files, shredded keys

    GuidedEasy

    Objective: Lock and unlock /mnt/w10b/rules.txt, shred two keys, then do both alone.

    chattr +i makes a file immutable: nobody, not even root, can change or delete it until chattr -i. shred overwrites a file's bytes; -u then deletes it.

    ▶ Play: Immutable files, shredded keysSOLUTION HIDDEN10 XP
  15. 279

    Level 279: Locks and shredders

    Alone⏱ TimedHard

    Objective: On /mnt/w10b: make harbor.conf immutable, and destroy leaked.key for real.

    chattr +i makes a file immutable: not even root can change or delete it until chattr -i (lsattr shows the i). rm only removes a name and the bytes stay on disk; shred -u overwrites them first.

    ▶ Play: Locks and shreddersSOLUTION HIDDEN40 XP
  16. 280

    Level 280: Only show me what broke

    GuidedEasy

    Objective: Re-check ~/lab/sums/SUMS loudly, then quietly, then save only what failed in NIGHT.sha256.

    sha256sum -c re-checks a list of fingerprints and prints OK or FAILED for every file. With --quiet it prints only the failures, so silence means all good.

    ▶ Play: Only show me what brokeSOLUTION HIDDEN10 XP
  17. 281

    Level 281: Baseline before the storm

    Alone⏱ TimedHard

    Objective: Take a SHA-256 baseline of every file under /etc/harbor into ~/baseline.sha256 and sign it; after the 'night', find the changed file.

    An integrity checker (AIDE, Tripwire) takes a baseline of fingerprints, then later lists what changed. You can do the same with find + sha256sum, and gpg-sign the list so nobody can swap it.

    ▶ Play: Baseline before the stormSOLUTION HIDDEN50 XP
  18. 282

    Level 282: BOSS: The certificate expired

    Boss⏱ TimedHard

    Objective: Bring 127.0.0.1:8443 back: a fresh self-signed cert with SAN DNS:harbor.local, installed and served, verified by s_client.

    PAGER 09:01: every client of https://harbor.local:8443 fails because the cert expired over the weekend. Diagnose, re-issue, install, reload, and prove it with a verifying client.

    ▶ Play: BOSS: The certificate expiredSOLUTION HIDDEN90 XP

World 21Security & Hardening

12 levels

Root's own chamber: who may become root, how the doors are locked, and how to catch someone who got in anyway.

  1. 283

    Level 283: Who can be root?

    GuidedEasy

    Objective: Besides guest, one user can run ANY command as root without a password: tell Kern who.

    sudo's rules live in /etc/sudoers and /etc/sudoers.d/: who may run what, as whom. NOPASSWD: ALL means instant root, no questions asked.

    Commands taughtsudoers

    ▶ Play: Who can be root?SOLUTION HIDDEN18 XP
  2. 284

    Level 284: install: copy with owner and mode

    GuidedEasy

    Objective: Learn install -m, -o and -g on ~/lab/install, then put a config file in place alone.

    cp copies a file, then you still need chown and chmod. install does all three in one command, which is how admins put config files in place.

    Commands taughtinstall

    ▶ Play: install: copy with owner and modeSOLUTION HIDDEN10 XP
  3. 285

    Level 285: Never edit sudoers blind

    GuidedEasy

    Objective: Check ~/staging/ops.sudoers with visudo, fix it, and install it as /etc/sudoers.d/ops (owner root, mode 440).

    One typo in a sudoers file can lock everyone out of sudo. visudo -c -f <file> checks a file before it goes live, and files in sudoers.d must be root-owned and not writable by others.

    Commands taughtvisudosu

    ▶ Play: Never edit sudoers blindSOLUTION HIDDEN20 XP
  4. 286

    Level 286: sshd: test before you trust

    GuidedEasy

    Objective: Learn sshd -t, -T and -f on ~/lab/sshd/lab.conf, then save one real setting alone.

    sshd is the SSH server. It can check a config file without starting (-t), and print every setting it would really use (-T): the truth, not what you think you wrote.

    ▶ Play: sshd: test before you trustSOLUTION HIDDEN10 XP
  5. 287

    Level 287: Harden the door

    AloneMedium

    Objective: Harden /etc/ssh/sshd_kern.conf: no root logins and no password logins (keys only).

    sshd reads its config top to bottom and the FIRST value of each setting wins. sshd -t -f <file> checks syntax and sshd -T -f <file> prints the settings it would really use.

    Commands taughtsshd-hardening

    ▶ Play: Harden the doorSOLUTION HIDDEN30 XP
  6. 288

    Level 288: find -xdev: stay on this disk

    GuidedEasy

    Objective: Learn to list SUID files with find -perm -4000 and -xdev in /opt/lab/suid, then hunt alone.

    A SUID program runs as its owner, so SUID root programs are the first thing an attacker looks for. find / walks every mounted disk too, unless you say -xdev.

    ▶ Play: find -xdev: stay on this diskSOLUTION HIDDEN10 XP
  7. 289

    Level 289: Hunt the SUID

    AloneMedium

    Objective: Someone planted an extra SUID-root program: find it and remove its SUID bit (the real ones stay).

    A SUID program runs as its owner, not as you: SUID root plus a program that can run commands (like find -exec) means a free root shell. find -perm -4000 lists them all.

    Commands taughtsuid-hunting

    ▶ Play: Hunt the SUIDSOLUTION HIDDEN30 XP
  8. 290

    Level 290: Find the intruder

    AloneMedium

    Objective: Someone brute-forced their way into server: tell Kern the IP that failed many times and then got in.

    sshd logs every login attempt: Failed password ... from <ip>, or Accepted ... from <ip>. A brute force is thousands of failures, and a breach is a success right after them.

    Commands taughtauth-logs

    ▶ Play: Find the intruderSOLUTION HIDDEN30 XP
  9. 291

    Level 291: The impostor thread

    AloneMedium

    Objective: One [kworker] in the process list isn't a kernel thread: kill the impostor.

    Kernel threads appear in [brackets] and are children of kthreadd, PID 2. A normal program can fake the name, but not the parent.

    Commands taughtsuspicious-processes

    ▶ Play: The impostor threadSOLUTION HIDDEN30 XP
  10. 292

    Level 292: The writable cron job

    Alone⏱ TimedHard

    Objective: Root's crontab runs a script anyone can edit: close the hole without breaking the job.

    If root runs a file you can write, you can make root run anything: that's privilege escalation. Cron jobs and their scripts are the classic hole.

    Commands taughtprivesc

    ▶ Play: The writable cron jobSOLUTION HIDDEN40 XP
  11. 293

    Level 293: Breach response

    Alone⏱ TimedHard

    Objective: The auth log shows whose password was cracked tonight: remove only that user's rule from /etc/sudoers.d/c3-team, then prove the rules are valid with visudo -c.

    When an account is cracked, its powers go first. Cut it out of sudoers, and let visudo -c prove you didn't break sudo for everyone else.

    Commands taughtincident-response

    ▶ Play: Breach responseSOLUTION HIDDEN40 XP
  12. 294

    Level 294: BOSS: The intruder is inside

    Boss⏱ TimedHard

    Objective: An intruder left a listening backdoor and a hidden SUID shell: shut the backdoor down and defuse the shell.

    Attackers leave ways back in: a program listening for them, or a SUID shell hidden somewhere boring.

    Commands taughtbackdoors

    ▶ Play: BOSS: The intruder is insideSOLUTION HIDDEN70 XP

World 22Job Tickets

13 levels

Capstones: real multi-step tickets from a sysadmin queue that combine everything you learned.

  1. 295

    Level 295: TICKET-1041: the status site

    Alone⏱ TimedHard

    Objective: Stand up the status site: a self-healing service, a SAN certificate, and a nightly backup timer, all reboot-proof.

    Your first ticket from the queue, from Ada (ops lead): 'We need status.harbor.local up by tonight: a service, a TLS cert, and a nightly backup, all surviving a reboot.'

    Commands taughtjob-tickets

    ▶ Play: TICKET-1041: the status siteSOLUTION HIDDEN80 XP
  2. 296

    Level 296: TICKET-1042: new disk day

    Alone⏱ TimedHard

    Objective: Put the new disk under LVM as /srv/data, mount it at boot by UUID, then grow it online.

    Requester: Bo (data team): 'The new disk is attached, and we need /srv/data on LVM so we can grow it later, mounted at every boot, then 8 MB more.'

    ▶ Play: TICKET-1042: new disk daySOLUTION HIDDEN80 XP
  3. 297

    Level 297: Default ACLs: rights that inherit

    GuidedEasy

    Objective: Learn setfacl -d and getfacl -d on ~/lab/acl/share, then set a default ACL alone.

    A normal ACL gives rights on one folder. A DEFAULT ACL is a template: every new file created inside gets those entries by itself.

    ▶ Play: Default ACLs: rights that inheritSOLUTION HIDDEN10 XP
  4. 298

    Level 298: TICKET-1043: onboard the crew

    Alone⏱ TimedHard

    Objective: Onboard mira and tomas into group crew with a shared SGID folder, default ACLs, a narrow sudo rule and password aging; then offboard tomas.

    Requester: HR + Ada. 'Mira and Tomas join the crew: shared folder, may restart crew-app (nothing else as root), 90-day passwords. Oh, and Tomas leaves on Friday.'

    ▶ Play: TICKET-1043: onboard the crewSOLUTION HIDDEN80 XP
  5. 299

    Level 299: TICKET-1044: backup & restore drill

    Alone⏱ TimedHard

    Objective: Back up /srv/prod with a SHA-256 manifest, wipe it, restore one file then everything, and prove the checksums match.

    Requester: the auditor. 'Show me a backup you can actually restore: archive, checksum manifest, delete, restore one file, restore all, prove nothing changed.'

    ▶ Play: TICKET-1044: backup & restore drillSOLUTION HIDDEN80 XP
  6. 300

    Level 300: sysctl and the harbor audit

    GuidedEasy

    Objective: Learn sysctl, sysctl -w and hidden, then switch ip_forward off alone.

    Kernel settings live under /proc/sys, and sysctl reads or changes them. Harbor also has an audit script, w12-audit, that prints PASS or FAIL per control.

    Commands taughtsysctl

    ▶ Play: sysctl and the harbor auditSOLUTION HIDDEN10 XP
  7. 301

    Level 301: TICKET-1045: pass the audit

    Alone⏱ TimedHard

    Objective: Make every control of hidden pass, and keep it passing after a reboot.

    Requester: security. 'Run the harbor audit (hidden). Every control must PASS, and still PASS after a reboot.'

    ▶ Play: TICKET-1045: pass the auditSOLUTION HIDDEN90 XP
  8. 302

    Level 302: TICKET-1046: outage + postmortem

    Alone⏱ TimedHard

    Objective: Bring the ledger service back (its journal names each fault), then write ~/postmortem.md with Timeline, Root cause and Action items.

    PAGER, then a ticket: 'ledger is down: fix it, then write the postmortem by end of day.' Four faults hide in one service, and the journal names them one at a time.

    ▶ Play: TICKET-1046: outage + postmortemSOLUTION HIDDEN100 XP
  9. 303

    Level 303: Scripts that stop on errors

    GuidedEasy

    Objective: Learn sh -x, set -e, set -u and || in ~/lab/strict, then write a strict script alone.

    A plain shell script keeps going after a command fails. set -e stops at the first failure, set -u stops on a misspelled variable, and sh -x shows every command as it runs.

    ▶ Play: Scripts that stop on errorsSOLUTION HIDDEN10 XP
  10. 304

    Level 304: TICKET-1047: script it (idempotent)

    Alone⏱ TimedHard

    Objective: Write ~/bin/provision.sh that sets up a box and is safe to run again and again (idempotent).

    Requester: Ada: 'We have 40 boxes, so write ONE script that sets each up (group fleet, /srv/fleet root:fleet 2775, motd=welcome once in /etc/fleet.conf) and is safe to run twice.' Idempotent means the second run changes nothing.

    ▶ Play: TICKET-1047: script it (idempotent)SOLUTION HIDDEN90 XP
  11. 305

    Level 305: apk info -v: which version?

    GuidedEasy

    Objective: Learn apk info and apk info -v, then save one package's version alone.

    apk info lists the installed packages by name. With -v each name carries its version too, which is what a security advisory asks about.

    ▶ Play: apk info -v: which version?SOLUTION HIDDEN10 XP
  12. 306

    Level 306: Pager drill: count, kill, carry on

    GuidedEasy

    Objective: Practise || true, pgrep -c and pkill -f in ~/lab/pager, then stop a worker swarm alone.

    Pages come fast, so three reflexes help: try a tool with || true so a failure doesn't stop you, count processes with pgrep -c, and kill a whole swarm with pkill -f.

    ▶ Play: Pager drill: count, kill, carry onSOLUTION HIDDEN10 XP
  13. 307

    Level 307: BOSS TICKET-1048: Patch Tuesday

    Boss⏱ TimedHard

    Objective: Find the outdated package, upgrade it from the local repo, restart the service that uses it, and prove the running greeter has 1.1-r0.

    Requester: security. 'Advisory: ptr-greet before 1.1-r0 leaks greetings. Patch every box today, make sure the RUNNING greeter uses the fix, and prove it is healthy.'

    ▶ Play: BOSS TICKET-1048: Patch TuesdaySOLUTION HIDDEN120 XP

Final examThe Root Exam

5 levels

Five broken machines, and Kern is not allowed to help: fix them all to earn the title of root.

  1. 308

    Level 308: Machine 1: The dead shop

    Exam⏱ TimedHard

    Objective: The shop at http://127.0.0.1:8088/ is down: get it serving its homepage.

    Customers see nothing at all. The shop runs as a service.

    ▶ Play: Machine 1: The dead shopSOLUTION HIDDEN60 XP
  2. 309

    Level 309: Machine 2: The flood

    Exam⏱ TimedHard

    Objective: /mnt/logs is full and still filling: stop whatever floods it and get it under 50% (keep app.log).

    A disk is filling up in real time. Stopping the cause comes before cleaning up.

    ▶ Play: Machine 2: The floodSOLUTION HIDDEN65 XP
  3. 310

    Level 310: Machine 3: Locked out

    Exam⏱ TimedHard

    Objective: Key login to server@server stopped working: fix it (no passwords).

    Key login used to work. Somebody 'fixed' permissions on the server.

    ▶ Play: Machine 3: Locked outSOLUTION HIDDEN60 XP
  4. 311

    Level 311: Machine 4: Lost names

    Exam⏱ TimedHard

    Objective: curl http://api.lan:8099/ must answer again: fix name resolution, not the URL.

    The API is alive, its address just never reaches the client.

    ▶ Play: Machine 4: Lost namesSOLUTION HIDDEN60 XP
  5. 312

    Level 312: Machine 5: The audit

    Exam⏱ TimedHard

    Objective: Remove tempadmin's sudo rights, forbid root logins in /etc/ssh/sshd_kern.conf and fix root's world-writable cron script.

    This box failed its security audit on three counts.

    ▶ Play: Machine 5: The auditSOLUTION HIDDEN70 XP

For teachers

Use these levels with a class

SOLUTION HIDDEN Teachers see answer keys in the classroom.

For teachers
ROOTSPIRE
DiscsFor teachers
▶ Play freeLibrary 16 discsDiscsFor teachersLog in