Every level, in the open
Linux: Zero to Root
23 worlds · 312 levels · 22 bosses
SOLUTION HIDDENTeachers see answer keys in the classroom.
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 1The Shell
12 levelsThe starting village, where Kern wakes up with a fragmented memory and you learn to talk to the machine.
Level 1: Who goes there?
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 taught
shellwhoamiLevel 2: Look around
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 taught
pwdlsLevel 3: Escape hatch
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 taught
ctrl-clessLevel 4: Walk the tree
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 taught
cdpathsLevel 5: Dear diary
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 taught
historyredirectionLevel 6: Read the manual
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 taught
manhelp-flagLevel 7: ls: the long view
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.
Level 8: ls: sort it your way
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.
Level 9: Tab, tab, tab
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 taught
tab-completionLevel 10: Too long, didn't read
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 taught
tldrLevel 11: What did I do yesterday?
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.
Level 12: BOSS: Seven copies
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.
World 2Files
12 levelsThe junkyard workshop where files are born, copied, moved, linked and lost, and everything vanishes at reboot.
Level 13: Open the workshop
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 taught
mkdirtouchLevel 14: Copy that
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 taught
cpLevel 15: The door sign
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 taught
nanoLevel 16: Signpost in the maze
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 taught
symlinkLevel 17: Move, rename, remove
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.
Level 18: Wildcards: * ? [ ]
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.
Level 19: The potion shuffle
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 taught
mvLevel 20: Attic of a thousand pixels
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 taught
globbingechoLevel 21: Two names, one heart
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 taught
hardlinkinodeLevel 22: Crash dump cleanup
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 taught
rmLevel 23: Surprise inspection
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.
Level 24: BOSS: Lost memories
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.
World 3The Editor
10 levelsThe scriptorium of vim, the editor waiting on every server: modes, motions, search and replace, all without a mouse.
Level 25: The escape hatch
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 taught
vimvim-modesLevel 26: First words
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 taught
vim-insertLevel 27: The contract
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 taught
vim-motionLevel 28: Spam filter
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 taught
vim-editLevel 29: The chant
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 taught
vim-yankLevel 30: Needle in the config
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 taught
vim-searchLevel 31: Line 37
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 taught
vim-linesLevel 32: New name
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 taught
vim-substituteLevel 33: Typo storm
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.
Level 34: BOSS: The gate
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.
World 4Reading & searching
19 levelsThe great library of logs, where the machine writes down everything and clues hide in a million lines.
Level 35: The night guard's note
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 taught
catLevel 36: Last heartbeat
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 taught
headtailLevel 37: Knock knock
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 taught
grepLevel 38: First pipes
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 taught
pipeswcLevel 39: grep: one switch at a time
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.
Level 40: grep: many files, quiet tests
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 taught
timeouttail-followLevel 41: Live feed
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 taught
tail-followLevel 42: Regex 1: letters and the dot
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 taught
regexLevel 43: Regex 2: star and anchors
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.
Level 44: Regex 3: sets in brackets
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'.
Level 45: Regex 4: -E, plus and question
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.
Level 46: Regex 5: counts, or, groups
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.
Level 47: Five hundred reasons
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 taught
regexLevel 48: The card catalogue
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 taught
locateLevel 49: find: walk the tree
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 taught
findLevel 50: find: size, age and actions
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.
Level 51: Needle in the archive
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 taught
findLevel 52: Night shift
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.
Level 53: BOSS: The intruder
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.
World 5Users & permissions
16 levelsThe castle of configuration, where every file has an owner, every door has a lock, and root holds all the keys.
Level 54: Borrow the crown
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 taught
sudoLevel 55: Hire an apprentice
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 taught
usersgroupsLevel 56: Read the locks
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 taught
permissionsLevel 57: Fireball permit
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 taught
chmodLevel 58: Owners and numbers
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 taught
chownchmod-octalLevel 59: The guild hall
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 taught
sgidstickyLevel 60: The guild charter
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 taught
chownchmod-octalLevel 61: umask: born private
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 taught
umaskLevel 62: Born private
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 taught
umaskLevel 63: ACLs: one extra guest
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 taught
aclLevel 64: One guest only
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 taught
aclLevel 65: usermod: join a group
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.
Level 66: The team drop
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.
Level 67: Night handover
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.
Level 68: sudo -u and SUID hunting
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 taught
suidLevel 69: BOSS: Site down
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 taught
suid
World 6Accounts
19 levelsThe castle's back office: hiring, passwords, holidays, expiry dates and goodbyes. (This lab keeps no login records, so sessions are tracked as processes.)
Level 70: The account book
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 taught
passwd-fileshadowLevel 71: Ask the phone book
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 taught
getentLevel 72: A password for tess
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 taught
passwdLevel 73: chage: password calendars
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 taught
chageLevel 74: The contractor
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 taught
chageLevel 75: Gone fishing
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 taught
usermodLevel 76: Login shells
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.
Level 77: No shell for robots
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 taught
nologinLevel 78: tee: write where you cannot
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 taught
teeLevel 79: The welcome kit
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 taught
skelLevel 80: su: wear another hat
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 taught
suLevel 81: Wearing another hat
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 taught
switch-userLevel 82: Who is here, what do they run
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 taught
pspgrepsessionsLevel 83: Who's still here?
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 taught
sessionsLevel 84: Removing accounts and groups
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 taught
userdelgpasswdLevel 85: Shift change
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 taught
userdelgpasswdLevel 86: Hidden jobs and hidden rights
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 taught
cronLevel 87: tar: pack a folder
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 taught
tarLevel 88: BOSS: Offboarding
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 taught
offboarding
World 7Text Power
18 levelsThe device forge, where streams flow through pipes and you bend text with sort, cut, sed and awk.
Level 89: Two mouths
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 taught
streamsstderr-redirectLevel 90: One bucket
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.
Level 91: Feed the seal
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 taught
stdin-redirectLevel 92: The bestseller
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 taught
sortuniqLevel 93: awk 1: fields
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 taught
awkLevel 94: awk 2: filters and totals
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.
Level 95: The dragon tax
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 taught
awkLevel 96: sed 1: find and replace
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 taught
sedLevel 97: sed 2: pick and delete lines
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.
Level 98: xargs: hand over the list
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 taught
xargsLevel 99: The sign painter
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 taught
sedxargsLevel 100: cut, tr, sort, head
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 taught
cuttrLevel 101: Silence the denied
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 taught
dev-nullLevel 102: Guild mailing list
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 taught
cuttrLevel 103: The tower moved
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'.
Level 104: Meet the census program
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.
Level 105: Census night
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.
Level 106: BOSS: Gatecrashers
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.
World 8Bash Scripting
12 levelsThe spell library, where every tool is a file and you learn to write programs of your own.
Level 107: Your first spell
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 taught
scriptsprintfLevel 108: Name badge
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 taught
variablesquotingLevel 109: Is it up?
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 taught
script-argsifexit-codesLevel 110: Shortcuts
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 taught
aliassourcebashrcLevel 111: Scroll roll call
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 taught
loopsparam-expansionLevel 112: The spellbook
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 taught
functionsLevel 113: Loot from anywhere
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 taught
path-varLevel 114: Night shift
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 taught
cronLevel 115: Photo flood
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.
Level 116: Welcome mat
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.
Level 117: Boxes that catch output
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.
Level 118: BOSS: The guard
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 taught
command-substitution
World 9Your Environment
12 levelsThe cloakroom where every shell gets dressed: variables, startup files, prompts, limits and time zones, for you and for every user.
Level 119: Pass it on
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 taught
exportLevel 120: Two doors
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 taught
login-shellsLevel 121: The house motto
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 taught
profile-filesLevel 122: Name tag
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 taught
ps1Level 123: Full house
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 taught
ulimitLevel 124: date and time zones
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 taught
timezoneLevel 125: Tokyo time
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 taught
timezoneLevel 126: pgrep -f and prlimit
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 taught
limitsLevel 127: The hungry daemon
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 taught
limitsLevel 128: The night report
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.
Level 129: kerntool and new users
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.
Level 130: BOSS: Welcome kit
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.
World 10Processes
14 levelsThe engine room, where programs come alive as processes and you learn to watch, pause and stop them.
Level 131: Who's running?
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 taught
processespsLevel 132: The lurker
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 taught
procfspgrepLevel 133: Background nap
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 taught
background-jobsjobsLevel 134: The pause button
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 taught
job-controlLevel 135: Stubborn
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 taught
killsignalsLevel 136: New orders
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.
Level 137: Signals: TERM, STOP, CONT
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.
Level 138: Freeze!
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.
Level 139: nice, renice and top
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.
Level 140: Be nice
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 taught
nicetopLevel 141: The lost journal
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 taught
file-descriptorsLevel 142: Rush hour
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.
Level 143: The ps table
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.
Level 144: BOSS: The hydra
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.
World 11Performance & Capacity
11 levelsRead load, memory, I/O and syscalls like a pro, tame hogs with nice and cgroups, and catch the OOM killer in the act.
Level 145: Read the load
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 taught
uptimeLevel 146: Free is not available
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 taught
freeLevel 147: vmstat: find the bottleneck
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 taught
vmstatLevel 148: Be nice (renice, ionice)
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 taught
ioniceLevel 149: strace: watch the syscalls
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 taught
straceLevel 150: Live gauges
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 taught
dmesgLevel 151: Who killed the app? (OOM)
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 taught
oom-killerLevel 152: Zombie harbor
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.
Level 153: Memory hog, 2 minutes
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.
Level 154: Stuck on what?
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.
Level 155: BOSS: The slow server
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.
World 12System & Services
16 levelsWhere the machine wakes: kernel, init, daemons, packages, modules. (This lab boots with busybox init, not systemd/OpenRC; apk is offline.)
Level 156: The kernel's diary
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 taught
kerneldmesgLevel 157: What the bootloader whispered
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 taught
kernel-cmdlineLevel 158: PID 1
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 taught
initLevel 159: The clock tower
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).
Level 160: logread: the system log
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 taught
syslogLevel 161: Crash loop
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 taught
syslogdaemonsLevel 162: apk info: whose file is it?
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 taught
apkLevel 163: Whose file is this?
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 taught
apkLevel 164: Inventory
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.
Level 165: Weekly chores
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.
Level 166: lsmod and modprobe
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.
Level 167: Load the driver
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 taught
kernel-modulesLevel 168: uname: which kernel?
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.
Level 169: The vendor's bug report
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.
Level 170: ss: who is listening?
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 taught
ssLevel 171: BOSS: The watchdog won't wake
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 taught
services
World 13Packages for Real
15 levelsThe castle shop: repos, installs, upgrades, pins and tamper checks, plus an apt/dnf phrasebook. (Offline: a local signed repo in /srv/apk/ptr.)
Level 172: Where packages come from
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 taught
apk-repositoriesLevel 173: Fresh index
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 taught
apk-updateLevel 174: First install
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 taught
apk-addLevel 175: apk search: window shopping
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.
Level 176: Window shopping
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 taught
apk-searchLevel 177: apk info -e and apk del
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.
Level 178: Tidy shelves
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 taught
apk-delLevel 179: apk version and upgrade
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.
Level 180: Patch day
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 taught
apk-upgradeLevel 181: apk policy and pins
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.
Level 182: Hold that version
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 taught
apk-pinLevel 183: apk audit and apk fix
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.
Level 184: Tampered goods
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 taught
apk-auditLevel 185: The phrasebook
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 taught
pkg-translateLevel 186: BOSS: Patch the box
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 taught
patching
World 14systemd: Services
12 levelsThe init system on every real job: start, stop, enable, read the journal. (SIM: ptrd stands in for systemd; the commands are the real ones.)
Level 187: Read the status card
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 taught
ptrdsystemctlLevel 188: start, stop, restart: try them
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.
Level 189: Start, stop, restart
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.
Level 190: enable and disable: try them
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.
Level 191: Survive the night (enable)
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.
Level 192: Failed units: reset-failed
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).
Level 193: Who is red?
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).
Level 194: The harbor's logbook
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 taught
journalctlLevel 195: journalctl: -p and -b
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.
Level 196: Only the errors
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.
Level 197: Shift change
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.
Level 198: BOSS: Harbor blackout
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.
World 15Units, Timers & Targets
9 levelsWrite your own services, override them with drop-ins, schedule timers and survive a crash loop across a reboot. (SIM: ptrd.)
Level 199: Write your first unit
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 taught
unit-filesLevel 200: Get back up (Restart=)
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.
Level 201: Override, never overwrite
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.
Level 202: Choose the boot target
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 taught
systemd-targetsLevel 203: Timers (cron, the systemd way)
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 taught
systemd-timersLevel 204: A logbook that survives
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 taught
journald-storageLevel 205: Ticket: signal, 4 minutes
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.
Level 206: list-units: filter by type
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.
Level 207: BOSS: The crash loop
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.
World 16Storage
16 levelsThe disk vaults: partitions, space, inodes, mounts, archives and the dreaded 100%. (No real disks here: partition tables live in image files.)
Level 208: How full is the vault?
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 taught
dfLevel 209: Who ate the disk?
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 taught
duLevel 210: The partition map
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 taught
partitionsLevel 211: df -i: counting the slots
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.
Level 212: Plenty of space, no room
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.
Level 213: Pack it up
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 taught
tarcompressionLevel 214: tar: unpacking, one file at a time
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.
Level 215: Restore just one file
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.
Level 216: mount: plug a filesystem in
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 taught
mountLevel 217: A disk made of RAM
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 taught
mountLevel 218: The old memory card
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 taught
loop-devicesLevel 219: A disk made of a file
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 taught
mkfsLevel 220: A disk in a file
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 taught
mkfsfileLevel 221: Disk rescue
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.
Level 223: BOSS: Disk full
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 taught
deleted-fileslsof
World 17Disks for Real
15 levelsThe loading dock: new disks get partitioned, formatted, named and written into /etc/fstab to survive reboots. (Disks here are loop devices.)
Level 224: A new disk arrives
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 taught
losetupLevel 225: Who's who
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 taught
blkidLevel 226: Slice it up
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 taught
gptLevel 227: Name tags
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 taught
labels-uuidLevel 228: Move-in day
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.
Level 229: Who is using that disk?
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 taught
fuserLevel 230: Target is busy
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 taught
fuserLevel 231: fstab: mounts that come back
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 taught
fstabLevel 232: Mount at every boot
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 taught
fstabLevel 233: Swap: spare memory on disk
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 taught
swapLevel 234: Swap at every boot
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.
Level 235: Room to breathe
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 taught
swapLevel 236: One disk, three filesystems
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 taught
xfs-vfatLevel 237: Camera day
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 taught
xfs-vfatLevel 238: BOSS: The 3 a.m. fstab
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.
World 18LVM & Repair
10 levelsDisks melt into pools: repair broken filesystems, grow them online, build LVM volumes that survive 3 a.m. and a reboot. (Disks are loop devices.)
Level 239: The scratched disk
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 taught
fsckLevel 240: The shop grows
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 taught
tune2fsresize2fsLevel 241: Your first volume group
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 taught
lvmLevel 242: LVM: stretching a volume
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 taught
lvextendLevel 243: Stretch /srv/web
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 taught
lvextendLevel 244: LVM: a photo of a volume
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 taught
lvm-snapshotLevel 245: A photo of the database
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 taught
lvm-snapshotLevel 246: A disk for /srv/data
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.
Level 247: Crashed and full
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.
Level 248: BOSS: 3 a.m., /srv/app is full
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.
World 19Linux Networking
16 levelsWhere machines talk: addresses, routes, names, ports, SSH and the web. (No internet here: server is a stub host on 127.0.0.2.)
Level 249: The way out
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 taught
ipLevel 250: Give it a name
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 taught
hosts-filepingteeLevel 251: Grab it
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 taught
wgetcurlLevel 252: Raise the wall
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 taught
firewallLevel 253: dig: ask one DNS server
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 taught
digLevel 254: Ask the resolver
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 taught
dnsdigLevel 255: Who's listening?
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 taught
ssLevel 256: SSH keys, step by step
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 taught
ssh-keygenLevel 257: Keys, not passwords
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 taught
sshssh-keygenLevel 258: scp: copy over SSH
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 taught
scpLevel 259: Ship it
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 taught
scpLevel 260: The first match wins
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.
Level 261: Configure a card by hand
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).
Level 262: Back online
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).
Level 263: curl -I: just the headers
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.
Level 264: BOSS: The website is down
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.
World 20Crypto & Integrity
18 levelsChecksums, GPG, certificates and encrypted disks: prove a file is untouched and keep secrets secret.
Level 265: Fingerprints of files
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 taught
sha256sumLevel 266: gpg without the pop-ups
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 taught
gpgLevel 267: Your own seal (gpg)
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 taught
gpgLevel 268: Trust, but verify
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.
Level 269: Forge a certificate
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 taught
opensslLevel 270: Reading a certificate
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.
Level 271: When does it expire?
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.
Level 272: Knock on a TLS door
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.
Level 273: Talk TLS by hand
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).
Level 274: The missing link
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'.
Level 275: LUKS 1: lock a disk
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 taught
cryptsetupLevel 276: LUKS 2: open, use, close
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.
Level 277: A vault on a disk (LUKS)
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 taught
cryptsetupLevel 278: Immutable files, shredded keys
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.
Level 279: Locks and shredders
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.
Level 280: Only show me what broke
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.
Level 281: Baseline before the storm
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.
Level 282: BOSS: The certificate expired
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.
World 21Security & Hardening
12 levelsRoot's own chamber: who may become root, how the doors are locked, and how to catch someone who got in anyway.
Level 283: Who can be root?
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 taught
sudoersLevel 284: install: copy with owner and mode
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 taught
installLevel 285: Never edit sudoers blind
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 taught
visudosuLevel 286: sshd: test before you trust
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.
Level 287: Harden the door
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 taught
sshd-hardeningLevel 288: find -xdev: stay on this disk
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.
Level 289: Hunt the SUID
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 taught
suid-huntingLevel 290: Find the intruder
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 taught
auth-logsLevel 291: The impostor thread
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 taught
suspicious-processesLevel 292: The writable cron job
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 taught
privescLevel 293: Breach response
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 taught
incident-responseLevel 294: BOSS: The intruder is inside
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 taught
backdoors
World 22Job Tickets
13 levelsCapstones: real multi-step tickets from a sysadmin queue that combine everything you learned.
Level 295: TICKET-1041: the status site
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 taught
job-ticketsLevel 296: TICKET-1042: new disk day
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.'
Level 297: Default ACLs: rights that inherit
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.
Level 298: TICKET-1043: onboard the crew
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.'
Level 299: TICKET-1044: backup & restore drill
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.'
Level 300: sysctl and the harbor audit
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 taught
sysctlLevel 301: TICKET-1045: pass the audit
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.'
Level 302: TICKET-1046: outage + postmortem
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.
Level 303: Scripts that stop on errors
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.
Level 304: TICKET-1047: script it (idempotent)
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.
Level 305: apk info -v: which version?
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.
Level 306: Pager drill: count, kill, carry on
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.
Level 307: BOSS TICKET-1048: Patch Tuesday
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.'
Final examThe Root Exam
5 levelsFive broken machines, and Kern is not allowed to help: fix them all to earn the title of root.
Level 308: Machine 1: The dead shop
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.
Level 309: Machine 2: The flood
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.
Level 310: Machine 3: Locked out
Objective: Key login to server@server stopped working: fix it (no passwords).
Key login used to work. Somebody 'fixed' permissions on the server.
Level 311: Machine 4: Lost names
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.
Level 312: Machine 5: The audit
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.
For teachers
Use these levels with a class
SOLUTION HIDDEN Teachers see answer keys in the classroom.