🐧 Linux Essentials for IT Support

Linux Essentials for IT Support

Ubuntu/Debian fundamentals: shell proficiency, systemd, filesystem navigation, and essential scripting.

Learning Objectives

Module 1: Ubuntu/Debian Installation & Boot Process

~2 hours

Lesson 1.1: Choosing and Installing Ubuntu LTS

Selecting the right edition, partitioning strategies, and post-installation first steps.

  • Desktop vs Server editions — which to choose
  • Manual partitioning: /boot, swap, /, /home layout
  • First-boot configuration wizard essentials

Lesson 1.2: The Boot Process & Recovery

GRUB, initramfs, kernel modules, and what to do when things go wrong.

  • BIOS/UEFI handoff and GRUB menu navigation
  • Recovery mode and root shell access
  • fsck and repairing broken mount points
$ sudo dpkg-reconfigure grub-pc # reconfigure bootloader if needed $ telinit 1 # switch to single-user mode $ fsck -y /dev/sda1 # check and fix filesystem errors

Terminal Exercise: Fresh Install & Recovery

  1. Download Ubuntu 22.04 LTS ISO (desktop or server — your choice)
  2. Boot from USB in a VM (VirtualBox recommended)
  3. Choose custom partitioning: separate /home and swap
  4. Break the system intentionally (remove /etc/passwd read perms)
  5. Boot into recovery mode and restore permissions using chroot

Real-World Scenario

A user reports their Ubuntu laptop won't boot past GRUB after a power outage. They've never used the terminal. Walk through recovering the system without losing user data.

Module 2: Filesystem Hierarchy & Navigation

~2 hours

Lesson 2.1: The FHS Standard

Understanding /bin, /etc, /var, /tmp, /proc, and why every directory matters.

  • /etc — configuration files (the heart of Linux admin)
  • /var/log — where diagnostics live
  • /proc and /sys — virtual filesystems exposing kernel state
  • /home vs /root — user vs administrative boundaries

Lesson 2.2: Essential CLI Navigation

pwd, cd, ls, find, locate — the daily driver toolkit for any sysadmin.

  • Relative vs absolute paths — understanding the difference
  • find with -name, -mtime, -size filters
  • locate vs find performance trade-offs
$ find /var/log -name "*.log" -mtime -7 # logs modified in last 7 days $ du -sh /home/* # quick size summary per user $ df -h # disk usage human-readable

Terminal Exercise: Navigate & Discover

  1. List all files in /etc modified in the last day
  2. Find any file larger than 100MB under /home recursively
  3. Count how many config files exist in /etc/nginx
  4. Locate the systemd journal log file manually

Knowledge Check

Q: What does `ls -la` show that `ls -l` does not? A: The dot-files (hidden files like .bashrc, .ssh).

Q: Where would you find network interface configuration? A: /etc/netplan/ or /etc/network/interfaces depending on distro.

Module 3: Text Editors — nano & vim

~2.5 hours

Lesson 3.1: nano for Quick Edits

nano is the friendly choice for beginners: intuitive, on-screen shortcuts, perfect for quick config changes.

  • Open, edit, save (^O), exit (^X)
  • Search and replace across files
  • Line numbers and syntax highlighting

Lesson 3.2: vim — The Power Editor

vim is indispensable for professionals. Learn the modes and essential movements now.

  • Modes: Normal, Insert, Command-line
  • Movement: h j k l, w, b, gg, G
  • Editing: i, a, d, c, y, u (undo!)
  • Saving: :w, :q, :wq, :q!
  • Opening config: vim /etc/hostname
[Normal mode] i # enter insert mode :wq # save and quit :q! # discard changes and quit dd # delete current line yy # copy (yank) current line pp # paste below /%search%/n # search and jump to next match

Terminal Exercise: Edit Without Mouse

  1. Create /tmp/test-edit.txt using touch
  2. Edit it with nano, add 3 lines, save and exit
  3. Edit the same file with vim — insert text, save with :wq
  4. Practice vim motions: jump to line 5, delete line 3, undo, redo
  5. Open /etc/resolv.conf in vim and change the nameserver

Real-World Scenario

A user's SSH authorized_keys file got corrupted. You must edit it over the terminal using only vim. Fix the formatting so each key is on its own line with correct key-type prefix.

Module 4: Permissions & Ownership

~2.5 hours

Lesson 4.1: rwx Fundamentals

chmod, chown, and the numeric/octal permission system.

  • r=4, w=2, x=1 — reading permission math
  • Owner, group, others breakdown
  • chmod 755 vs 644 — common defaults
  • setuid, setgid, and sticky bit basics

Lesson 4.2: Advanced Access Control

ACLs, capabilities, and SELinux/AppArmor context awareness.

  • getfacl / setfacl for fine-grained permissions
  • umask defaults and changing them permanently
  • sudoers file editing and visudo safety
$ ls -l /etc/shadow # see owner/root root rw------- $ chmod 640 /etc/secrets # owner rw, group r, others nothing $ chown -R user:staff /home/project $ getfacl /var/data

Terminal Exercise: Permission Forensics

  1. Create a directory structure simulating a team project
  2. Set permissions so the dev team can read/write but others can only read
  3. Make a script executable and demonstrate why it fails without +x
  4. Use sudoers to grant a test user passwordless apt install for nginx only

Knowledge Check

Q: What do the permissions `rwsr-xr-x` indicate? A: setuid bit is set on the owner execute bit.

Q: Why can't you chmod /etc/shadow for regular users? A: Only root can modify it; shadow perms should be 640 owned by root:shadow.

Module 5: Users & Groups

~2 hours

Lesson 5.1: User Management Commands

useradd, usermod, userdel, passwd — managing identities in /etc/passwd and /etc/shadow.

  • UID/GID assignment and the 1000+ threshold for normal users
  • Login shells and home directory creation
  • Locking vs deleting accounts (the difference matters in investigations)

Lesson 5.2: Group Policy Equivalent

groupadd, gpasswd, supplementary groups, and the principle of least privilege.

  • Adding users to docker, sudo, lpadmin groups
  • SGID directories for shared team folders
  • Checking group membership with id and groups commands
$ sudo useradd -m -s /bin/bash developer $ sudo usermod -aG docker,sudo developer $ echo "developer:TempPass123!" | sudo chpasswd $ id developer # verify groups $ sudo deluser developer # full removal including home

Terminal Exercise: User Provisioning Script

  1. Create 3 test users with home directories
  2. Add them to appropriate groups (dev, ops, guest)
  3. Set password policies requiring password change on first login
  4. Lock one account and verify lock status with passwd -S
  5. Write a bash script that automates this entire provisioning

Real-World Scenario

An ex-employee still has active SSH keys on three production servers. You need to remove their primary account, purge all authorized_keys references, and rotate shared service passwords they may have known.

Module 6: Package Management with apt

~2 hours

Lesson 6.1: apt Basics

apt-get and apt commands for installing, removing, and maintaining software.

  • apt update vs apt upgrade — the critical distinction
  • Installing specific versions and holding packages
  • Clean, autoremove, autoclean for disk management

Lesson 6.2: Sources Lists & PPA Management

Managing repositories, adding PPAs, and handling vendor-specific apt sources.

  • /etc/apt/sources.list and sources.list.d/
  • GPG key management for third-party repos
  • dpkg for .deb file installs when apt isn't available
$ sudo apt update && sudo apt upgrade -y $ sudo apt install nginx curl git -y $ sudo apt hold nginx # prevent upgrades $ sudo apt-mark showhold # see held packages $ sudo apt autoremove --purge # clean orphaned deps

Terminal Exercise: Software Lifecycle

  1. Install Docker CE from the official Docker apt repository
  2. Hold the Docker package to prevent accidental removal during upgrades
  3. Simulate a broken dependency situation and resolve it
  4. List all installed packages sorted by size (largest first)

Knowledge Check

Q: What is the difference between apt upgrade and apt full-upgrade? A: full-upgrade allows removing currently installed packages if needed for the upgrade (like apt-get dist-upgrade).

Q: How do you find which package owns /etc/nginx/nginx.conf? A: dpkg -S /etc/nginx/nginx.conf

Module 7: Services & systemd

~3 hours

Lesson 7.1: systemctl Essentials

Starting, stopping, enabling, and monitoring services on modern Linux.

  • systemctl status/start/stop/enable/disable
  • journald and journalctl for service logs
  • Understanding service unit files (.service)

Lesson 7.2: Unit Files & Custom Services

Writing and deploying custom systemd units for applications.

  • Environment variables in service files
  • WantedBy and Requires directives
  • Reloading daemons after unit changes
$ sudo systemctl status sshd # check SSH service $ sudo systemctl enable --now nginx # start and enable at boot $ journalctl -u nginx --since "1 hour ago" $ sudo systemctl daemon-reload # after editing unit files

Terminal Exercise: Create & Manage a Service

  1. Create a simple Python script that runs forever (server simulation)
  2. Write a systemd .service unit file in /etc/systemd/system/
  3. Start, enable, and verify the service is running
  4. Generate a failure by killing the process unexpectedly and review journalctl logs
  5. Implement restart=always and test automatic recovery

Real-World Scenario

A web app crashes every night at 2 AM during a database backup window. It's managed by systemd but doesn't restart automatically. Diagnose, configure proper restart behavior, and set up a systemd timer instead of cron for more reliable scheduling.

Module 8: Cron Jobs & Scheduled Tasks

~1.5 hours

Lesson 8.1: crontab Syntax

* * * * * — minute, hour, day, month, weekday explained with real examples.

  • Common patterns: daily backups, hourly checks, weekly maintenance
  • @reboot and @monthly shortcut notations
  • Crond environment vs interactive shell — PATH traps

Lesson 8.2: Systemd Timers (Modern Alternative)

When to prefer timers over cron for reliability and logging.

  • OnCalendar= syntax equivalents
  • Advantages: boot timing, persistent triggers, integrated logging
$ crontab -e # Every day at 3:15 AM — note absolute paths in cron! 15 3 * * * /usr/bin/rsync -a /data/backups/ /mnt/backup/daily/ # Every Sunday at midnight 0 0 * * 0 /opt/scripts/weekly-report.sh >> /var/log/weekly.log 2>&1

Terminal Exercise: Schedule Reliability

  1. Create a script that logs the current timestamp to /tmp/cron-test.log every minute
  2. Schedule it with crontab and verify it executes
  3. Create a systemd timer that runs the same task hourly
  4. Compare the two approaches: which is easier to debug?

Module 9: Basic Shell Scripting

~3 hours

Lesson 9.1: Bash Fundamentals

Variables, conditionals, loops, and input/output redirection basics.

  • #!/bin/bash shebang and making scripts executable
  • $?, $#, $1-$9 positional parameters
  • If/then/elif/else and test expressions [ ]
  • for loops, while loops, and case statements

Lesson 9.2: Practical Sysadmin Scripts

Scripts that solve real problems: disk monitoring, user auditing, log rotation helpers.

  • Checking disk usage and alerting on thresholds
  • Counting failed login attempts from auth.log
  • Automated backup verification with checksums
#!/bin/bash # disk-check.sh — Alert if any partition exceeds 85% usage THRESHOLD=85 while read -r line; do pct=$(echo "$line" | grep -oP '\d+%') pct_num=${pct%\%} if [ "$pct_num" -gt "$THRESHOLD" ]; then echo "ALERT: $line exceeds ${THRESHOLD}%" | mail -s "Disk Alert" admin@corp.com fi done <(df -h | tail -n +2)

Terminal Exercise: Build Your First Automation

  1. Write a script that checks if nginx is running and starts it if not
  2. Add logic to send an email notification on restart
  3. Schedule the script via cron to run every 5 minutes
  4. Write a second script that archives old logs older than 30 days

Real-World Scenario

Your boss asks you to generate a weekly report listing: number of user accounts, top 5 disk-using directories in /home, and count of failed SSH login attempts last week. All from a single script running on five servers.

Module 10: SSH Setup & Secure Remote Access

~2 hours

Lesson 10.1: SSH Configuration Deep Dive

sshd_config hardening, key generation, and trust relationships.

  • rsa vs ed25519 keys — which to use
  • Disabling password auth, enforcing key-only login
  • Changing the default port (cosmetic but reduces noise)
  • AllowUsers and AllowGroups restrictions

Lesson 10.2: Advanced SSH for IT Support

SSH tunnels, X11 forwarding, port knocking, and bastion hosts.

  • scp and rsync over SSH for file transfers
  • -L and -D port forwarding for secure browsing
  • ssh-config proxy jump for jumping through firewalls
$ ssh-keygen -t ed25519 -C "admin@hostname" $ ssh-copy-id user@remote-server $ ssh -J bastion.corp.com user@internal-db # jump host $ scp /local/file user@host:/remote/path $ ssh -L 8080:localhost:80 user@server # local tunnel

Terminal Exercise: Hardened SSH Deploy

  1. Set up two VMs; generate ed25519 keys on one
  2. Copy the public key to the other's authorized_keys
  3. Hardened sshd_config: disable root login, password auth, enable only ed25519
  4. Verify login works without password; attempt fails with password
  5. Create an SSH config alias for easy access

Knowledge Check

Q: How do you connect to a server through a bastion host? A: `ssh -J bastion.example.com user@internal-server`.

Q: What's in ~/.ssh/known_hosts? A: Host keys of previously connected servers to prevent MITM attacks.

Progress: 0%