RousselTMLEARNING

Article · Linux administration: from discovery to expertise

Linux best practices

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

📄 Linux administration best practices →

My progress

  • ⏱ Estimated time : ≈ 6 min

Sign in to track your progress and take notes. Sign in

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

Linux server security and hardening

Harden a Linux server: least privilege, updates, secure SSH, firewall, fail2ban, SELinux and AppA...

Backup, monitoring and troubleshooting of a Linux server

Operate a Linux server day to day: 3-2-1 backup strategy with rsync, tar, LVM snapshots and resti...

Linux vs Unix: the complete guide to commands and distributions

Understand the differences between Linux and Unix, explore distributions (server, desktop, lightw...

Processes, memory and performance: monitoring and troubleshooting a Linux server

Understand and control Linux processes (ps, top, signals, nice, jobs), interpret load, memory and...

Users, groups, sudo and permissions on Linux

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

Storage on Linux: disks, partitions, file systems and LVM

Administer Linux storage: lsblk and blkid, GPT partitioning, ext4 and XFS, mounting and /etc/fsta...

Networking on Linux: configuration, diagnosis, firewall and SSH

Configure and troubleshoot Linux networking: ip, ss, netplan and NetworkManager, DNS, layered dia...

Linux system architecture: kernel, boot and directory tree

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

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

Master the Linux command line: paths, file handling, wildcards, redirections, pipes, searching wi...

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!