RousselTMLEARNING

Systems & Linux

Linux administration best practices

Checklist for administering Linux servers: accounts and sudo, SSH, updates, systemd services, storage, network and firewall, tested backups, monitoring, automation and documentation.

1. Access and accounts #

Knowing who does what.

Rules #

  • Named accounts, never direct root login or shared accounts.
  • SSH key-based authentication only, keys protected by a passphrase, bastion for access from the Internet.
  • sudo limited to the necessary commands, edited with visudo in /etc/sudoers.d/.
  • Service accounts without a shell, one per application.
  • Quarterly review of accounts, groups and authorized_keys.

2. System and services #

A predictable server.

Rules #

  • Distribution with long-term support, minimal installation.
  • Automatic security fixes; scheduled reboots when /var/run/reboot-required exists.
  • Services managed by systemd, with Restart=on-failure and sandboxing options.
  • Never modify units shipped by packages: systemctl edit.
  • systemd timers rather than cron for logging and catch-up.
  • Synchronized time (timedatectl, chrony): essential for correlating logs.

3. Storage, network and security #

Avoidable sources of incidents.

Rules #

  • LVM with free space in the VG; UUID and nofail in fstab; mount -a before any reboot.
  • Separate data (/var/lib, /srv) from the system so that filling up does not block the OS.
  • Default-deny firewall, only the necessary ports open, and only to the necessary sources.
  • Internal services listening on 127.0.0.1 or on the private network.
  • SELinux or AppArmor in enforcing mode.
  • fail2ban on exposed services, centralized authentication logs.

4. Operations #

Lasting.

Rules #

  • 3-2-1 backups, encrypted, with regular restore tests.
  • Monitoring of disks, memory, services, backups and certificates, with actionable alerts.
  • All configuration described in Git and applied by Ansible: the server must be rebuildable.
  • Scripts with set -euo pipefail, checked by ShellCheck.
  • Every intervention traced (ticket, commands), with a rollback plan.

Reference diagram and quick check #

Checklist.

Checklist #

Reference Linux server
Controlled access, filtered network, backups, monitoring and configuration as code.
cat /etc/os-release ; uname -r ; uptime
sudo apt list --upgradable 2>/dev/null | wc -l ; ls /var/run/reboot-required 2>/dev/null
sudo sshd -T | grep -E 'permitrootlogin|passwordauthentication'
sudo ufw status verbose || sudo firewall-cmd --list-all
ss -tlnp
systemctl --failed
df -h ; df -i ; free -h
sudo journalctl -p err -b --no-pager | tail
getent group sudo ; sudo ls /etc/sudoers.d
systemctl list-timers | grep -i backup ; restic snapshots --latest 1
timedatectl | grep synchronized
getenforce 2>/dev/null || sudo aa-status | head -3

Related articles

Linux system architecture: kernel, boot and directory tree

Understand how a Linux server works: kernel and user space, the UEFI, GRUB, initramfs and systemd boot sequen…

The Bash shell and files: navigation, redirections, pipes and text processing

Master the Linux command line: paths, file handling, wildcards, redirections, pipes, searching with find and …

Users, groups, sudo and permissions on Linux

Manage Linux accounts (useradd, usermod, passwd, chage), groups, sudo and visudo, rwx and octal permissions, …

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!