5 tasks · includes 1 PBQ-style timed task · not scored
These need both servers running. Work with two terminals side by side - one on deb-srv, one on rpm-srv - and run each command on both. That habit is the whole point of this module.
Identify a system with no prior knowledge of it
Log into each server and determine, using only commands: the distribution and version, the family it belongs to, the kernel version, the architecture, the default systemd target, and whether a mandatory access control system is enforcing.
How to check: Six facts about each machine, obtained without guessing from the hostname.
Perform the same five tasks on both families
On each server: install tree, find out which package provides /usr/bin/tree, list every file that package installed, find what would provide the dig command, and remove tree again. Record both command sets side by side.
How to check: A translation table of five operations in both dialects, produced by you rather than copied.
Discover the service-start difference for yourself
Install nginx on both servers. Without starting anything, check on each whether the web server is running and whether it will start at next boot. Then make both serve a page.
How to check: You can state what each family does on install, and you have both servers responding to curl localhost.
Write a script that works on both families
Write whichfam.sh that detects the family from /etc/os-release and reports the correct package manager, firewall tool and MAC system for that machine. It must run unmodified on both servers and exit non-zero on an unrecognised system.
How to check: One script, copied to both servers, producing correct and different output on each.
Cross-family identification under time PBQ · 10 min
Set a timer for ten minutes. On rpm-srv only, and without consulting notes: determine the distribution and major version; find which package owns /etc/ssh/sshd_config; determine whether the SSH service is enabled at boot; find which firewall zone is active and which services it permits; and state the default filesystem type of the root partition.
What you produce: All five answers correct, within ten minutes, using only the command line and man.
Show the model answer
Identify a system with no prior knowledge of it
$ cat /etc/os-release | head -3 PRETTY_NAME="Ubuntu 24.04.1 LTS" NAME="Ubuntu" VERSION_ID="24.04" $ uname -r && uname -m 6.8.0-45-generic x86_64 $ systemctl get-default multi-user.target $ aa-status --enabled && echo "AppArmor enabled" AppArmor enabled
$ cat /etc/os-release | head -3 NAME="Rocky Linux" VERSION="9.4 (Blue Onyx)" ID="rocky" $ cat /etc/redhat-release Rocky Linux release 9.4 (Blue Onyx) $ getenforce Enforcing $ systemctl get-default multi-user.target
/etc/os-release is the one file present on every modern Linux system, and it is the correct first question. It is machine-readable, so scripts can source it directly:
$ . /etc/os-release && echo "$ID $VERSION_ID" rocky 9.4 $ . /etc/os-release && echo "$ID_LIKE" rhel centos fedora
ID_LIKE is the field that answers "which family is this?" — on Ubuntu it reads debian. Module 12's Ansible playbooks branch on exactly this.
The family-specific files are also worth knowing: /etc/redhat-release exists only on the RPM side, /etc/debian_version only on the other. Testing for one is a crude but reliable family check in a shell script.
Note that both machines return multi-user.target — no graphical target, because you installed them headless. Had you installed a desktop by mistake, this is where you would see it.
Perform the same five tasks on both families
$ sudo apt update && sudo apt install -y tree $ dpkg -S /usr/bin/tree tree: /usr/bin/tree $ dpkg -L tree | head -4 /usr/bin/tree /usr/share/doc/tree $ sudo apt install -y apt-file && sudo apt-file update $ apt-file search bin/dig dnsutils: /usr/bin/dig $ sudo apt remove -y tree
$ sudo dnf install -y tree $ rpm -qf /usr/bin/tree tree-1.8.0-10.el9.x86_64 $ rpm -ql tree | head -4 /usr/bin/tree /usr/share/doc/tree $ sudo dnf provides */bin/dig bind-utils-9.16.23-24.el9.x86_64 : Utilities for querying DNS name servers $ sudo dnf remove -y tree
Three observations worth carrying forward.
The high-level verbs match almost exactly — install, remove, search. This is deliberate on dnf's part and means the everyday commands transfer immediately.
The query tools differ in style. dpkg uses separate flags; rpm combines them onto a query mode. rpm -qf is "query, by file"; rpm -ql is "query, list files"; rpm -qa is "query, all". Once you read the q as a mode rather than an option, the rest is mechanical.
dnf provides needs no extra package, whereas the Debian side requires installing and indexing apt-file first. The RPM metadata includes file lists for uninstalled packages by default. A small thing, but it is the sort of difference that wastes ten minutes when you do not expect it.
Note also the RPM version string: tree-1.8.0-10.el9.x86_64 encodes name, version, release, el9 (Enterprise Linux 9) and architecture. That naming convention is worth recognising on sight.
Discover the service-start difference for yourself
$ sudo apt install -y nginx $ systemctl is-active nginx; systemctl is-enabled nginx active enabled $ curl -s -o /dev/null -w '%{http_code}\n' localhost 200 already running, already enabled, already serving
$ sudo dnf install -y nginx $ systemctl is-active nginx; systemctl is-enabled nginx inactive disabled $ curl -s --max-time 3 localhost; echo "exit $?" exit 7 connection refused - nothing is listening $ sudo systemctl enable --now nginx $ curl -s -o /dev/null -w '%{http_code}\n' localhost 200 serving now - but only to itself
$ curl -s --max-time 3 http://192.168.56.12; echo "exit $?" exit 7 refused from another machine. Why?
Two separate obstacles on the RPM side, and meeting them together is instructive.
The first is the policy difference: Debian-family packages start and enable services on install; RPM-family packages do not. Red Hat's position is that bringing a network service up is an administrator's decision, not a side effect of installing software. systemctl enable --now does both jobs — recall from intermediate Module 7 that start and enable are unrelated.
The second is the firewall, which is active by default on Rocky and not on Ubuntu. It does not filter a server's traffic to itself, which is why curl localhost answered, but it turns away requests from other machines:
$ systemctl is-active firewalld active $ sudo ss -tulpn | grep :80 tcp LISTEN 0.0.0.0:80 users:(("nginx",pid=2104)) nginx IS listening - so the block is in front of it $ sudo firewall-cmd --add-service=http --permanent && sudo firewall-cmd --reload
$ curl -s -o /dev/null -w '%{http_code}\n' http://192.168.56.12 200
The diagnostic sequence there is the transferable part: ss -tulpn proved the service was listening, which eliminated nginx and pointed at the firewall. Intermediate Module 10 taught that command; here it settles a cross-family question in one step.
Leave nginx installed on both — Module 8 returns to it.
Write a script that works on both families
#!/usr/bin/env bash # # whichfam.sh - report family-specific tooling for this host set -euo pipefail [[ -r /etc/os-release ]] || { echo "no /etc/os-release" >&2; exit 1; } # shellcheck disable=SC1091 . /etc/os-release family="unknown" case " ${ID} ${ID_LIKE:-} " in *" debian "*|*" ubuntu "*) family="debian" ;; *" rhel "*|*" fedora "*) family="rpm" ;; esac case "$family" in debian) pm="apt"; fw="ufw"; mac="AppArmor" ;; rpm) pm="dnf"; fw="firewall-cmd"; mac="SELinux" ;; *) echo "unsupported distribution: ${PRETTY_NAME:-$ID}" >&2; exit 2 ;; esac printf '%-12s %s\n' "System:" "${PRETTY_NAME:-$ID $VERSION_ID}" printf '%-12s %s\n' "Family:" "$family" printf '%-12s %s\n' "Packages:" "$pm" printf '%-12s %s\n' "Firewall:" "$fw" printf '%-12s %s\n' "MAC:" "$mac"
$ chmod +x ~/bin/whichfam.sh $ for h in deb-srv rpm-srv; do > scp -q ~/bin/whichfam.sh "$h":~/ && ssh "$h" './whichfam.sh'; echo > done System: Ubuntu 24.04.1 LTS Family: debian Packages: apt Firewall: ufw MAC: AppArmor System: Rocky Linux 9.4 (Blue Onyx) Family: rpm Packages: dnf Firewall: firewall-cmd MAC: SELinux
The important design decision is testing ID_LIKE as well as ID. Testing ID alone would fail on Mint, AlmaLinux, Raspberry Pi OS and dozens of derivatives; ID_LIKE names the parent family, so the script covers everything downstream of both without listing them.
The spaces in " ${ID} ${ID_LIKE:-} " and in each pattern make the match whole-word — without them, an ID of redhat-ish would match *rhel*. And ${ID_LIKE:-} supplies an empty default, because Debian itself has no ID_LIKE field and set -u would otherwise abort.
Run shellcheck on it. This detection pattern reappears in Module 12 as the basis for cross-family Ansible.
Cross-family identification under time PBQ · 10 min
$ . /etc/os-release; echo "$NAME $VERSION_ID" Rocky Linux 9.4 $ rpm -qf /etc/ssh/sshd_config openssh-server-8.7p1-38.el9.x86_64 $ systemctl is-enabled sshd enabled $ sudo firewall-cmd --get-active-zones public interfaces: enp0s3 $ sudo firewall-cmd --list-services cockpit dhcpv6-client http ssh $ findmnt -no FSTYPE / xfs
Five commands, five answers. The exam's performance-based questions are exactly this shape: a specific fact to establish on a live system, with the clock running.
Two habits that save time under pressure:
- Prefer the command that answers exactly the question.
findmnt -no FSTYPE /returns one word;df -Tormount | grepmakes you read a table.systemctl is-enabledreturns one word wheresystemctl statusreturns twenty lines. - Note the service name difference. It is
sshdon the RPM side andsshon the Debian side. Getting this wrong wastes a question. Ubuntu providessshd.serviceas an alias, but the reverse is not true.
If you exceeded ten minutes, the usual cause is reaching for status and --help rather than knowing the direct query. That is what repetition fixes, and it is why these tasks are timed.