Midterm week: six weeks, one toolkit
420-302-VA · WEEK 7 · FALL 2026

Review 1 of 3 · Weeks 1 to 3 · plan two sessions

Toolkit review

Three weeks, one workbench: a version-controlled project, a Linux machine you administer over the network, and a lock on the door. This page is the theory of all three, compressed to what carries the rest of the course, with the self-tests the exam will feel like.

The map: three machines, two kinds of link

Three machines: your laptop, GitHub in the cloud, and the Raspberry Pi. Git push and pull connect laptop and Pi to GitHub over HTTPS or SSH keys. SSH connects the laptop directly to the Pi for administration. Your laptop edit · commit · administer Raspberry Pi runs the code · headless GitHub (remote) the shared, backed-up history push / pull pull / push ssh username@lastname-pi administer over the network, no monitor needed
The whole workbench on one diagram. Code moves through GitHub (copper): commits pushed from one machine, pulled on another. You move through SSH (green): a terminal on the Pi from anywhere on the network. The two links answer different questions, "where does the work live?" and "how do I drive the machine?", and keeping them distinct untangles half of the Weeks 1 to 3 material.

Week 1: Git's model, compressed

Git's entire mental model is four areas and the moves between them. The working directory is the files as they are right now. The staging area is the shopping basket: changes you have marked for the next snapshot. The local repository is the chain of snapshots (commits) on your machine, each with an author, a message and a pointer to its parent. The remote is the same chain on GitHub, shared and backed up. Every daily command is a move: git add promotes working-directory changes to the basket; git commit turns the basket into a permanent snapshot; git push sends new snapshots to the remote; git pull fetches and applies the remote's new snapshots. Commit and push are therefore different acts: committing is local and costs nothing; nothing reaches GitHub, or your partner, or the grader, until a push. Two parallel histories touching the same lines meet as a merge conflict: Git writes both versions into the file between <<<<<<<, ======= and >>>>>>> markers and refuses to guess; you edit the file to the version you want, delete the markers, then add and commit the resolution. Full story, diagrams included: Week 1's ideas page.

The Git command core

CommandMove it performs
git statusShow where every change currently sits; the first command of any confused moment
git add file · git add .Working directory → staging area, one file or everything
git commit -m "message"Staging area → local repository, as one snapshot with a message
git push · git pullLocal ↔ remote: publish your new commits; fetch and apply theirs
git log --onelineThe chain of snapshots, one line each, newest first
git clone URLCopy a remote repository, history and all, onto a new machine
git diffExactly what changed and is not yet staged

Week 2: the Linux models

Three models carry everything the terminal asks of you. First, the filesystem is one tree rooted at /, your territory at /home/username, and every command runs somewhere in that tree: pwd names the spot, paths are directions from it (.. up one, ~ home), and most "file not found" moments are really "wrong somewhere" moments. Second, commands are verbs with options and objects: ls -la, verb plus flags plus (implicit) place; learning twelve verbs well beats recognizing fifty. Third, the boot chain: power applied, the Pi's firmware loads the bootloader from the boot drive, which loads the Linux kernel, which starts services (SSH among them), which is why a headless Pi is reachable about half a minute after power without any screen, and why a corrupted boot drive fails before anything else can. Headless workflow in one breath: Raspberry Pi Imager writes the OS with hostname lastname-pi, your username and SSH enabled; the Pi boots on the bench network; ssh username@lastname-pi from the laptop, and the machine is yours. Full detail: Week 2's terminal page and its cheat sheet.

The command core

CommandDoesCommandDoes
pwdWhere am Icat fileShow a file's contents
ls -laList everything here, details and hidden filesnano fileEdit; Ctrl+O save, Ctrl+X leave
cd folder · cd .. · cdMove in; up one; homecp src dst · mv src dstCopy; move or rename
mkdir -p a/bMake folders, parents includedrm file · rm -r folderDelete, no recycle bin, forever
hostname -IThe Pi's address on the networksudo commandRun as administrator, deliberately, not by habit

Week 3: the security trio

Updates. The apt cycle is two distinct acts, and the distinction is exam-grade: sudo apt update refreshes the catalogue, what versions exist, installing nothing; sudo apt full-upgrade -y then installs the newer versions the refreshed catalogue revealed; sudo apt autoremove -y sweeps packages nothing needs anymore. Why it matters is Week 3's opening story: unpatched, default-credential devices are exactly what the Mirai botnet harvested by the hundred thousand, and an IoT course that skips patching trains the next harvest.

Keys. SSH keys replace guessable passwords with mathematics. ssh-keygen mints a pair: the private key, which never leaves the machine it was born on, and the public key, which you hand out freely; ssh-copy-id installs the public half on the Pi, and from then on login works by the Pi issuing a challenge only the private key can answer. No secret crosses the network at login, which is why a key cannot be phished in transit the way a password can. The same model, public key uploaded to the service, authenticated both your laptop→Pi logins and the Pi→GitHub connection.

Firewall. UFW's stance is default deny incoming: every service port is closed unless explicitly allowed. The iron rule of order: allow SSH's port 22 before enabling the firewall, because enabling first slams the one door you are standing behind, and a headless machine with SSH blocked is reachable only by pulling the drive. Verify with sudo ufw status verbose. The general principle behind all three: minimize attack surface, then verify the state, never assume it. Full pages: updates, keys, firewall.

Self-test: write the command

Paper and pen, answers covered. These are the exam's favourite shape: a described task, one line expected.

1 · Save the staged changes as a snapshot with the message "wire the button".
git commit -m "wire the button". No push happened; the snapshot exists only locally until one does.
2 · Your partner pushed overnight. Bring their commits into your copy before working.
git pull. Pull before work, push after: the two-ended habit that prevents most conflicts.
3 · Show which changes are staged, which are not, and which files are untracked.
git status. It answers "where does everything sit?" across all four areas.
4 · Make the folder ~/iot/week8 even though ~/iot may not exist yet, then go there.
mkdir -p ~/iot/week8 then cd ~/iot/week8. The -p creates missing parents without complaint.
5 · Refresh the package catalogue, then install everything newer, confirming automatically.
sudo apt update then sudo apt full-upgrade -y. Two acts: learn what exists, then install it.
6 · Generate a modern SSH keypair, then install its public half on the Pi.
ssh-keygen -t ed25519 then ssh-copy-id username@lastname-pi. The private key stays where it was born.
7 · In what order do you run sudo ufw allow 22 and sudo ufw enable, and what happens in the other order on a headless Pi?
Allow first, enable second. The other order blocks SSH while SSH is your only way in: the firewall comes up, your session is the last one, and recovery means physical access to the drive.
8 · Show the Pi's firewall state, rules and defaults, to verify rather than assume.
sudo ufw status verbose. Week 3's habit in one command: after any security change, look at the resulting state.

Checklist for this review

Check yourself

You committed twice but your partner sees nothing on GitHub. Which concept explains it, in one sentence?
Commit is local: snapshots enter the local repository and reach the remote only on git push. Two areas, one missing move.
What do <<<<<<< markers in a file mean, and what is the three-step exit?
A merge conflict: both branches changed these lines and Git recorded both versions, refusing to choose. Edit the file to the version you want (markers deleted), git add it, git commit the resolution.
Why does a headless Pi become SSH-reachable with no screen ever attached?
The boot chain needs no display: firmware loads the bootloader from the boot drive, the bootloader loads the kernel, the kernel starts services, SSH among them. The Imager's presets (hostname, user, SSH on) made the result reachable by name.
Why is sudo apt update alone not an update, in the everyday sense?
It only refreshes the catalogue of available versions; nothing installs. full-upgrade performs the installation the refreshed catalogue makes possible. Running upgrade without update installs from stale information; update without upgrade installs nothing at all.
In key-based login, what crosses the network, and what never does?
The public key (freely shareable) and a challenge-response pass over the network; the private key never leaves its machine. That is why there is no secret in transit to steal.
"Default deny incoming" is a stance, not a rule list. What does it commit the machine to?
Every inbound port is closed unless explicitly allowed: services are opted in one by one (22 for SSH), and anything you forgot to allow is safe by default rather than exposed by default. Minimal attack surface as a starting position.