Module 2 · Services, SSH and Hardening · Lesson 6 of 10
Services: running now versus starting at boot
Use systemctl and journalctl to inspect a service and see why active and enabled are different questions.
In this lesson · about 18 minutes
- Check a service's current state and boot setting
- Read a service's logs with journalctl
- Disable only services you've shown are unnecessary
Whiteboard · watch and try
Whiteboard: active vs enabled
Press Play. The tutor shows why the two switches are different questions.
Tip: press Pause, then use the pen to work along on the board. Space plays and pauses; Ctrl+Z undoes your last mark.
Try it · watch it happen
Service switches: now vs at boot
Flip the switches, then restart the server and see which services come back.
| Service | Running nowis-active | Starts at bootis-enabled | Listens on |
|---|---|---|---|
| sshLets admins log in from far away | 🚪 22 (whole network) | ||
| nginxThe web server that shows the website | 🚪 80 (whole network) | ||
| cupsPrinting. This server has no printer | 🚪 631 (this machine only) | ||
| avahi-daemonAnnounces the machine to nearby devices | 🚪 5353 (local network) | ||
| backup-toolSomeone started it by hand to test it | — |
disable --now).Try this: switch backup-tool's "starts at boot" off, then restart. It doesn't come back. Then switch cups's "running now" off but leave boot on, and restart.
Ubuntu manages background programs (services or units) with systemd. Every service you leave running is something an attacker could talk to, so knowing what runs is basic hardening.
| Command | Answers |
|---|---|
systemctl status ssh | Full picture: loaded? running? recent log lines |
systemctl is-active ssh | Now: is it running? (active / inactive / failed) |
systemctl is-enabled ssh | Boot: will it start automatically? (enabled / disabled / masked) |
journalctl -u ssh --since today | That unit's log messages |
sudo systemctl disable --now cups | Stop it now and don't start it at boot |
Active and enabled are independent. A service can be enabled but inactive (it crashed, or was stopped by hand) or active but disabled (someone started it by hand; it won't survive a reboot).
On Ubuntu the SSH unit is usually called ssh; on other distributions it's often sshd. Confirm the actual unit name with systemctl list-units --type=service.
Hands-on lab (simulated terminal)
Practice challenge 04: inspect a service
The lab VM was given to you "as is". Inspect the print service cups, which a server rarely needs. Sudo password: lab.
Step 1 of 5. Type each command and press Enter. Nothing runs on your computer.
1. Show the full status of cups.
Check your understanding0 of 3 correct
Quiz score: 0 of 3
Noviq Academy is free and for learning. Every terminal here is simulated and every log is synthetic. Practise on a disposable VM with a snapshot, never on a production server. Ubuntu is a trademark of Canonical Ltd.; this course is independent of Canonical.