Skip to main content
Techlogia — AI and Web Development Berlin

Practise this module for free on a real VM

Sign up for free
 All courses
Free to read – no sign-up

Hello World

Your start in the lab: in a few minutes you learn how the automatic check verifies your solutions on the real VM — and you finish by blocking root login via SSH. 4 short tasks.

Duration: 10 minLevel: BeginnerExercises: 4

Validator tour

Welcome — how the validator works

This short intro module shows you how the lab checks your solutions. Every task is automatically validated on your real VM — you get instant feedback whether it passed. You will meet three kinds of checks here:

  • File content (file_content): checks whether a file contains a certain text.
  • Command output (command_output): runs a command and checks its output.
  • Service status (service_status): checks whether a system service is running.

This way you know exactly what "Check" means in all later modules. Click Check after each task.

Your goal

You solve one task per check type and finish with real mini hardening: you block root login via SSH.

Exercises

  1. 1. File content check

    Check type 1: file content. This check verifies whether a file contains a certain text. Write Lab Session into the file /etc/issue (the login banner).

    echo "Lab Session" | sudo tee /etc/issue

    Check: /etc/issue contains the text Lab Session.

  2. 2. Command output check

    Check type 2: command output. This check runs a command and verifies its output. Enable the UFW firewall so that ufw status returns the text Status: active.

    sudo ufw --force enable
    sudo ufw status

    Check: ufw status outputs Status: active.

  3. 3. Service status check

    Check type 3: service status. This check verifies whether a system service is running. Start the fail2ban service.

    sudo systemctl ____ --now fail2ban

    Check: the fail2ban service is active (systemctl is-active fail2ban).

  4. 4. Mini hardening: block root login

    Check type 2 once more — this time with real hardening. A server that lets root log in via SSH is the favourite target of automated attacks. You block root login and make the SSH service load the change. The checker uses sshd -T to read the effective configuration: all files together (including /etc/ssh/sshd_config.d/) plus defaults — the way SSH applies it the next time it loads.

    In /etc/ssh/sshd_config, set the option PermitRootLogin to no, then reload the SSH service.

    sudo sed -i -E 's/^#?PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config
    sudo systemctl reload ssh

    Without reload the running service keeps using the old value until it restarts. The check does not notice (sshd -T reads the files) — so the reload always belongs to the job.

    Check: sudo sshd -T | grep permitrootlogin shows permitrootlogin no.

Knowledge check: Hello World

No VM needed, about 3 minutes. You recall what you practiced in this module – wrong answers come back at the end.

Related courses

Now practice it yourself

Reading is good – doing is better. Practise this module on a real Linux VM, right in your browser. A free account is all it takes.

Start for free

Lab content under CC BY 4.0 – free to use with attribution (© TechLogia).

How do you like this page?