Linux Administration MOC
Hub for running Linux machines: the shell, services, power and disks, access, and recovery when things break.
Core concepts
Shell & processes
- Environment Variables Reach Child Processes Only When Exported: shell vs environment variables, sourcing, secrets, persistence.
- A Container Shares the Host Kernel, a Virtual Machine Runs Its Own: namespaces, cgroups, OverlayFS and the shared kernel.
- set -e Misses a Failure Inside a Pipeline Unless pipefail Is Set:
-e,-u,pipefail, where errexit is ignored,SIGPIPEwithhead. - A Shell Glob Expands Before sudo Runs, So sudo rm on a Root-Only Directory Can Delete Nothing: who expands
*, unmatched globs,rm -fsilence,find -delete.
Files, permissions & integrity
- Unix Permissions Grant Read, Write and Execute Separately to the Owner, the Group and Everyone Else: reading
ls -l, octal modes, directory rights, root's exemption,umask 077, NFS root squash. - A Checksum Proves a Copy Is Identical, Not That the Backup Restores: SHA-256,
sha256sum -c, what a checksum doesn't prove, tampering. - A Backup Bundle Packs Everything One Restore Needs into a Single File:
tar --zstd, atomic renames, sortable UTC names, the 3-2-1 rule.
Services & hardware
- Laptops Used as Servers Must Ignore the Lid Switch in logind:
HandleLidSwitch*and logind drop-ins. - Idempotent Scripts Check the Current State Before Changing It: Bash techniques for bootstrap scripts.
- After a Power Cut, Nodes Must Boot After the Storage They Mount: boot order and the BIOS power-loss setting.
- DKMS Builds a Driver Against the Running Kernel, So Missing Headers or Secure Boot Leave It Unloaded: kernel headers,
dkms statusadded vs installed, Secure Boot and MOK signing. - Runtime Kernel Changes Last Until Reboot Unless Written to Their Configuration Directory: runtime changes vs
modules-load.d,sysctl.dand fstab; the swap that came back after a reboot; Debian 13 ignoring/etc/sysctl.conf.
Name resolution
- Linux Reads the hosts File Before DNS Because nsswitch.conf Lists files First: the
hosts:line ofnsswitch.conf,getentvsdig, stale pinned entries.
Disks & recovery
- ext4 Remounts Root Read-Only When It Cannot Trust the Disk, and the kubelet Falls with It: journaling, read-only remounts and hardware death.
- With No Active Root Entry in fstab, systemd Leaves the Root Filesystem Read-Only on Every Boot: read-only on every boot with a healthy disk.
Automation
- Ansible become_method su Runs a Non-Login Shell Without sbin in PATH:
suvssu -and the missingsbindirectories. - Inventory ansible_user Overrides a Play's remote_user: which user Ansible really connects as.
- In a Regex, the Whitespace Class Also Matches Newlines, So One Pattern Can Span Two Lines:
\sacross line breaks in Ansible'sreplace, the fstab line it commented out.
Runbooks (05 - SOPs & Manuals/)
- Linux CLI Cheat Sheet: OS release, disks, permissions, network,
sedone-liners,TERM. - Neovim Cheat Sheet: my
init.luamappings, Telescope, nvim-tree,:sort, LSP. - Set Up SSH Key Authentication: Ed25519 keys, agent, config aliases, disabling passwords.
- Allow Web Traffic Through ufw Without Locking Out SSH: a firewall that keeps you in.
- Set a Static IP Address on Debian with ifupdown: fixed addresses for servers.
- Recover a Read-Only Root Filesystem with fsck:
fscksafely, remount, check the drive. - Install Docker Engine and the Compose Plugin on Debian or Ubuntu: Docker's apt repository.
- Deploy a Django App on a VPS with PostgreSQL and Gunicorn: a full VPS deployment.
- Troubleshooting Missing Sudo Command on Minimal Debian 13 Installations:
sudoon a minimal Debian. - Bash Scripting Cheat Sheet: strict mode, heredocs,
"$@"andexecwrappers, traps,${!var}, Bash 3.2 on macOS.
Related maps
- Kubernetes MOC: Debian hosts as cluster nodes.
- Networking MOC: addressing, DNS and firewalls.
- DevOps and Infrastructure as Code MOC: automating these machines.
References
- The Debian Administrator's Handbook - reference for Debian administration.
- systemd documentation - services, units and logind.