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.

5 steps
Press Play and the tutor will talk you through it while writing on the board. Pause any time to write on the board yourself.

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.

ServiceRunning nowis-activeStarts at bootis-enabledListens 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—
3 doors open to the network. Every running service that listens is a door someone could knock on.
Running but not needed: cups, avahi-daemon. Switch both off (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.

CommandAnswers
systemctl status sshFull picture: loaded? running? recent log lines
systemctl is-active sshNow: is it running? (active / inactive / failed)
systemctl is-enabled sshBoot: will it start automatically? (enabled / disabled / masked)
journalctl -u ssh --since todayThat unit's log messages
sudo systemctl disable --now cupsStop 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.

Practice challenge 04: inspect a service

1. Show the full status of cups.

admin@ubuntu-lab:~$

Check your understanding0 of 3 correct

Question 1

1.Is an enabled service necessarily running?

Question 2

2.Which command shows a service's log messages?

Question 3

3.Before disabling a service, what should you have?

Quiz score: 0 of 3

Tip: answer every quiz question correctly first.

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.