Hands-on Lab · adinusa.id

Linux Sysadmin

Ubuntu 24.04  ·  Apache2 · grep · find · fdisk · diff · useradd

Quiz · Troubleshooting

Apache2 Service Failure & 403 Fix

Apache2 systemctl vim mod_ssl VirtualHost
01Detected connection failure with curl http://localhost — port 80 unreachable.
02Checked systemctl status apache2: syntax error on line 148 of apache2.conf — bare SSLEngine directive with no value and no SSL module loaded.
03Fixed by setting SSLEngine off and enabling the SSL module via a2enmod ssl. Alternative: comment out the line entirely.
04After restart, 403 persisted — no <Directory> block in the VirtualHost. Apache defaults to deny-all.
05Added Require all granted inside a <Directory /var/www/html> block in 000-default.conf, restarted Apache. Index page served successfully.
Resolved — curl returns HTTP 200

Challenge 1 · Log Analysis

Working with File Content

grep regex anchors pipe stdout redirect
01Extracted all INFO-level lines from sample1.log using grep "INFO" — saved to output1.log.
02Extracted lines starting with illegal from sample2.log using the anchor grep "^illegal" — saved to output2.log.
03Combined two patterns — router_forward_getOI and TRACE level — via a pipeline of two grep calls — saved to output3.log.
3 output files verified

Challenge 2 · File System

Finding Files by Permission & Size

find -perm SUID / SGID -size -exec cp
01Found files with both SUID and SGID bits set using -perm -u=s,g=s — saved absolute paths to suid.txt.
02Copied all files with mode 0600 to backup/ using -exec cp {} dest \;, preserving original permissions.
03Filtered files sized between 8K and 10K using -size +7k -size -11k and copied them to size/.
04Found *.txt files not owned by user student using -not -user student — saved paths to extension.txt.
All 4 tasks completed

Challenge 3 · Storage

Partition, Format & Persistent Mount

fdisk mkfs.ext4 blkid mount /etc/fstab
01Created /dev/sdd1 (1 GiB) with fdisk /dev/sdd — selected primary partition, set last sector to +1G, wrote the table.
02Formatted with mkfs.ext4 -L appcache /dev/sdd1; confirmed UUID with blkid.
03Created mount point /app and mounted with mount LABEL=appcache /app.
04Added LABEL=appcache /app ext4 defaults,nofail 0 2 to /etc/fstab; tested with mount -a.
Mounted at /app — persists across reboots

Challenge 4 · File Comparison

Comparing Files & Directories

diff --ignore-case -r recursive awk grep
01Case-insensitive file comparison using diff --ignore-case fileA fileB — redirected output to results01.txt.
02Recursive directory diff with diff -r compare01 compare02 piped through awk to extract the absolute path of the single differing file — saved to results02.txt.
03Found files unique to comdir02 by grepping diff output, then used awk '{print $4}' to isolate bare filenames — saved to results03.txt.
3 result files produced

Challenge 5 · IAM

User & Group Account Management

useradd usermod chage groupadd passwd /etc/passwd
01Created users trainer1–3 with useradd -s /bin/bash; set initial password via passwd; added GECOS comments with usermod -c.
02Set maximum password age to 7 days for trainer1: chage -M 7 trainer1.
03Locked trainer2 account: usermod --lock trainer2 — login returns authentication failure.
04Forced trainer3 to change password on first login: chage -d 0 trainer3.
05Created group coaches via groupadd; added trainer1 and trainer2 as supplementary members with groupmod -U.
06Changed trainer3 default shell to /bin/sh via usermod -s /bin/sh trainer3.
All policies verified with su & id