A production-ready Ubuntu 26.04 LTS server checklist
Before an Ubuntu server takes real traffic, it needs a known, repeatable baseline. This checklist covers Ubuntu 26.04.1 LTS. Each step says what to change, why it matters and how to check it worked.
About this checklist
It suits a single server or a small fleet you look after yourself. For more than a handful of servers, put the same steps into Ansible or cloud-init so every server ends up the same.
Older guides can mislead you, because 26.04 changed several defaults since 24.04:
sudois now sudo-rs, a rewrite in Rust. Normal sudoers files still work. The original is installed assudo.ws.- Most core tools such as
lsanddfnow come from Rust coreutils.cp,mvandrmare still the GNU versions. - Time sync uses chrony with Network Time Security (NTS), not systemd-timesyncd.
- OpenSSH is version 10.2. It prefers post-quantum key exchange and no longer supports DSA keys.
- fail2ban reads the systemd journal and bans with nftables out of the box.
- Kernel crash dumps (kdump) are switched on by default.
- A server upgraded from 24.04 keeps some old defaults, so run this checklist again after an upgrade.
Before you start
- Make sure you can reach the server’s console (your provider’s web console or KVM). If an SSH or firewall change locks you out, that is your way back in.
- Take a snapshot or backup first.
- Keep a second SSH session open while you change SSH or the firewall. Test a fresh login before you close it.
- Write down the fixed IP addresses or VPN range you connect from. You need them to lock SSH down.
- Run the commands as a user with sudo.
- Swap the example values for your own: the
deployuser,app-01.example.com, SSH port2222, the203.0.113.10and198.51.100.0/24addresses, andops@example.com.
1. Base system
sudo apt update && sudo apt full-upgrade -y
sudo hostnamectl set-hostname app-01.example.com
sudo timedatectl set-timezone Europe/London
sudo apt install -y curl git htop rsync ufw fail2ban auditd unattended-upgrades needrestart apparmor-utils
cat /etc/os-release | grep PRETTY_NAME
[ -f /var/run/reboot-required ] && cat /var/run/reboot-required- The version line should say Ubuntu 26.04.1 LTS or later.
- Check
hostname -freturns the full name. If not, add it to/etc/hosts. - Reboot if the last command says a reboot is needed.
- Use
ipandssinstead of the oldnet-toolscommands. - Optional: attach Ubuntu Pro with
sudo pro attach YOUR_TOKEN. It is free for personal use on up to 5 machines. It adds security updates for more packages, plus Livepatch.
2. Admin user and SSH keys
On your own machine:
ssh-keygen -t ed25519 -C "you@laptop"On the server:
sudo adduser deploy
sudo usermod -aG sudo deploy
sudo passwd -l root
sudo awk -F: '$2 == "" {print $1}' /etc/shadow
awk -F: '$3 >= 1000 && $3 < 65534 {print $1}' /etc/passwdBack on your own machine, copy the key and test it:
ssh-copy-id deploy@app-01.example.com
ssh deploy@app-01.example.com sudo -v- The last command must work before you go further. It proves that key login and sudo both work for
deploy. - The root password is locked by default on Ubuntu.
passwd -l rootmakes sure. - The
awkon/etc/shadowshould print nothing. Any name it prints has no password. - The other
awklists human accounts. Remove any you do not need. Cloud images often include anubuntuuser. - sudo-rs does not support session recording (I/O logging and
sudoreplay) or LDAP sudoers. Its password prompt also looks different, which can break scripts that wait for the old prompt. If you need the original, switch withsudo update-alternatives --config sudo. - If your sudoers rules use wildcards inside command arguments, test them. sudo-rs is stricter about these.
3. SSH hardening
sshd uses the first value it reads, and it reads /etc/ssh/sshd_config.d/ in name order before the main file. Cloud images often ship 50-cloud-init.conf with PasswordAuthentication yes. A file starting with 10- wins over it.
sudo tee /etc/ssh/sshd_config.d/10-hardening.conf > /dev/null << 'EOF'
Port 2222
PermitRootLogin no
PasswordAuthentication no
KbdInteractiveAuthentication no
PubkeyAuthentication yes
AuthenticationMethods publickey
PermitEmptyPasswords no
MaxAuthTries 3
LoginGraceTime 30
ClientAliveInterval 300
ClientAliveCountMax 2
X11Forwarding no
AllowAgentForwarding no
AllowTcpForwarding no
PermitTunnel no
AllowUsers deploy
LogLevel VERBOSE
EOF
sudo sshd -t && sudo systemctl daemon-reload
if systemctl is-active --quiet ssh.socket; then sudo systemctl restart ssh.socket; else sudo systemctl restart ssh; fi
sudo sshd -T | grep -Ei '^(port|permitrootlogin|passwordauthentication|kbdinteractiveauthentication|authenticationmethods|allowusers) '
sudo ss -tlnp | grep sshdPort 2222moves SSH off port 22. Bots probe port 22 all day, so this stops most of the noise. Any unused port works. If UFW or a cloud firewall is already switched on, allow the new port there before you run this.- Ubuntu starts SSH through
ssh.socket, which takes its port from this config.daemon-reloadand the socket restart apply the new port. A plainreloadwould not. Your current session stays open. ssshould show SSH listening on 2222 only.- From your second terminal, check a new login works:
ssh -p 2222 deploy@app-01.example.com. Then check passwords are refused:ssh -p 2222 -o PubkeyAuthentication=no deploy@app-01.example.comshould fail with “Permission denied (publickey)”. - On your own machine, add
Port 2222under the host in~/.ssh/configso you do not need-pevery time. - Leave
Ciphers,MACsandKexAlgorithmsalone. The OpenSSH 10 defaults are strong and put the post-quantummlkem768x25519-sha256exchange first. Lists copied from older guides often remove it. - Be careful with cipher lists copied from web pages. Some sites’ email protection turns names such as
aes256-gcm@openssh.cominto “[email protected]”. That breaks sshd. - DSA keys no longer work at all. Replace any old ones with ed25519.
- OpenSSH now slows down addresses that keep failing to log in (
PerSourcePenalties). It is on by default. Leave it on. AllowTcpForwarding nostops SSH tunnels, such as a database app that connects through SSH. Set it toyesif you need them.
4. Firewall (UFW)
Deny everything incoming by default. Then open only what you need.
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'sudo ufw allow from 203.0.113.10 to any port 2222 proto tcp comment 'SSH office'
sudo ufw allow from 198.51.100.0/24 to any port 2222 proto tcp comment 'SSH VPN'If you have no fixed IP address or VPN, you can open SSH to everyone with a rate limit instead. Treat this as the fallback, not the goal.
sudo ufw limit 2222/tcp comment 'SSH'Moving SSH to port 2222 in section 3 already stops most bot probing. That hides the door but does not lock it, so keep keys only and the rate limit as well.
Check the rules, then switch the firewall on:
sudo ufw show added
sudo ufw enable
sudo ufw status verbose- Use one SSH option or the other, never both. An open rule on the SSH port makes the IP rules pointless.
- There is no rule for port 22, so it stays closed by the default deny.
- Read the
ufw show addedoutput before you enable. There must be an SSH rule that matches the address you are connecting from. - If your IP address changes later, use the provider’s console to add the new one.
- UFW rules cover IPv6 as well as IPv4. Add your IPv6 range too if you connect over IPv6.
- Docker publishes container ports through its own firewall rules, which skip UFW. On a Docker host, bind published ports to
127.0.0.1or filter them in theDOCKER-USERchain. - If your provider has a cloud firewall or security group, use it as well. It drops traffic before it reaches the server.
5. fail2ban
On 26.04 the fail2ban package already watches SSH. It reads the systemd journal and bans with nftables. You only need to tune it.
sudo tee /etc/fail2ban/jail.local > /dev/null << 'EOF'
[DEFAULT]
bantime = 1h
bantime.increment = true
findtime = 10m
maxretry = 5
ignoreip = 127.0.0.1/8 ::1 203.0.113.10
[sshd]
enabled = true
port = 2222
EOF
sudo fail2ban-client -t && sudo systemctl enable fail2ban && sudo systemctl restart fail2ban
sudo fail2ban-client status sshd- The status should show a “Journal matches” line. If it shows a “File list” line instead, add
backend = systemdunder[sshd]. - Do not copy
logpathorbackend = autolines from older guides./var/log/auth.logmay not exist on a new server, and then the jail sees nothing. portmust match your SSH port, or bans block the wrong port.bantime.incrementmakes repeat offenders wait longer each time.- Put your own fixed IP addresses in
ignoreipso you never ban yourself. - If SSH is locked to your IP addresses, this jail will rarely fire. It is still worth having for web jails later.
6. Automatic security updates and reboots
unattended-upgrades installs security updates on its own. Check it is on, then add your settings.
cat /etc/apt/apt.conf.d/20auto-upgrades
sudo tee /etc/apt/apt.conf.d/52unattended-upgrades-local > /dev/null << 'EOF'
Unattended-Upgrade::Mail "ops@example.com";
Unattended-Upgrade::MailReport "on-change";
Unattended-Upgrade::Remove-Unused-Dependencies "true";
Unattended-Upgrade::Automatic-Reboot "false";
EOF
sudo unattended-upgrade --dry-run --debug- The first command should show
Update-Package-Lists "1"andUnattended-Upgrade "1". If the file is missing, runsudo dpkg-reconfigure -plow unattended-upgrades. - Use your own file, as above. Do not edit
50unattended-upgrades, because package updates can replace it. - Email reports only work once the server can send mail (section 10).
- Kernel updates need a reboot. Check for
/var/run/reboot-requiredand plan a time. Livepatch (Ubuntu Pro) covers many kernel fixes until then. needrestartrestarts services that still use old libraries after an update.- If a short outage at night is fine, set
Automatic-Reboot "true"and addUnattended-Upgrade::Automatic-Reboot-Time "03:30";.
7. Kernel settings, core dumps and AppArmor
sudo tee /etc/sysctl.d/90-hardening.conf > /dev/null << 'EOF'
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0
net.ipv6.conf.default.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv6.conf.all.accept_source_route = 0
net.ipv4.conf.all.log_martians = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.tcp_syncookies = 1
kernel.kptr_restrict = 2
kernel.dmesg_restrict = 1
fs.suid_dumpable = 0
EOF
sudo sysctl --system
echo '* hard core 0' | sudo tee /etc/security/limits.d/90-no-core.conf
sudo aa-status- Ubuntu already sets some of these. Putting them in one file makes your intent clear.
rp_filter = 1is strict. It can break servers with more than one network route, including some VPN setups. Use2on those.- Do not switch off IP forwarding on a Docker host. Docker needs it.
- Core dumps can hold passwords and keys from memory. The two core dump lines stop programs writing them.
- Kernel crash dumps are a separate feature, and 26.04 turns them on. They land in
/var/crashand can also hold secrets. Keep that folder readable by root only, and clear old dumps. - AppArmor is on by default.
aa-statusshould list profiles in enforce mode. Never switch AppArmor off to make an app work. Fix the profile instead.
8. Audit logging (auditd)
auditd records who changed sensitive files and who ran commands as root. It matters more on 26.04, because sudo-rs cannot record sessions itself.
sudo tee /etc/audit/rules.d/50-baseline.rules > /dev/null << 'EOF'
-w /etc/passwd -p wa -k identity
-w /etc/group -p wa -k identity
-w /etc/shadow -p wa -k identity
-w /etc/gshadow -p wa -k identity
-w /etc/sudoers -p wa -k sudoers
-w /etc/sudoers.d/ -p wa -k sudoers
-w /etc/ssh/sshd_config -p wa -k sshd
-w /etc/ssh/sshd_config.d/ -p wa -k sshd
-w /etc/crontab -p wa -k cron
-w /etc/cron.d/ -p wa -k cron
-w /etc/netplan/ -p wa -k network
-w /etc/hosts -p wa -k network
-a always,exit -F arch=b64 -S execve -F euid=0 -F auid>=1000 -F auid!=unset -k root_cmds
-a always,exit -F arch=b32 -S execve -F euid=0 -F auid>=1000 -F auid!=unset -k root_cmds
EOF
sudo augenrules --load
sudo systemctl enable --now auditd
sudo auditctl -lauditctl -lshould list the rules. Search later withsudo ausearch -k sudoers -i.- The
root_cmdsrules log every command a logged-in person runs as root. They can be noisy on a busy server. - Optional: add
-e 2as the last line. It locks the rules until the next reboot, so an attacker cannot switch them off.
9. Time sync and logs
Ubuntu 26.04 uses chrony with Network Time Security (NTS). NTS proves the time servers are real, so nobody can feed your server a false time.
chronyc tracking
sudo chronyc -N authdata
sudo mkdir -p /etc/systemd/journald.conf.d
printf '[Journal]\nSystemMaxUse=1G\n' | sudo tee /etc/systemd/journald.conf.d/size.conf
sudo systemctl restart systemd-journaldchronyc trackingshould show “Leap status: Normal”.authdatashould show NTS in the Mode column.- A server upgraded from 24.04 still uses systemd-timesyncd. Move it over with
sudo apt-mark auto systemd-timesyncd && sudo apt install chrony. - The default servers are in
/etc/chrony/sources.d/ubuntu-ntp-pools.sources. To add your own, put a new.sourcesfile in that folder and runsudo chronyc reload sources. Do not overwrite/etc/chrony/chrony.conf. - Logs live in the systemd journal. Read SSH logs with
journalctl -u ssh. Do not rely on/var/log/auth.logbeing there. - The journald setting caps the journal at 1 GB so logs cannot fill the disk.
- Send logs off the server, for example with Vector, Grafana Alloy or
systemd-journal-upload. Anyone who gets root can wipe local logs.
10. Monitoring and alerts
- Run an uptime check and a TLS expiry check from outside the server. A server cannot tell you it is down.
- For metrics, install
prometheus-node-exporterfrom Ubuntu’s own repositories, so apt keeps it patched. - Only let your monitoring server reach it:
sudo ufw allow from 198.51.100.20 to any port 9100 proto tcp. - Set up send-only mail with
sudo apt install -y msmtp-mta bsd-mailx, then point msmtp at your mail provider. Test withecho test | mail -s test ops@example.com. Without this, update reports and alerts go nowhere.
Disk and inode alert. Save it as /usr/local/sbin/disk-alert, make it executable, and run it hourly from cron:
#!/bin/sh
# Emails a warning when any real disk is over LIMIT percent full (space or inodes).
LIMIT=80
OUT=$( { df -P; df -Pi; } | awk -v limit="$LIMIT" '
$1 ~ /^(tmpfs|devtmpfs|udev|overlay|efivarfs|none)$/ || $1 ~ /^\/dev\/loop/ { next }
$5 ~ /^[0-9]+%$/ && $5 + 0 > limit { print $6, $5 }' | sort -u )
if [ -n "$OUT" ]; then
printf '%s\n' "$OUT" | mail -s "Disk or inode use over ${LIMIT}% on $(hostname)" ops@example.com
fi11. Backups
- Back up databases with a consistent dump (for example
mysqldump --single-transaction), plus uploaded files,/etc, secrets and crontabs. - Follow the 3-2-1 rule: three copies, on two kinds of storage, with one off-site.
- Encrypt backups. Store them where the server cannot delete them, using append-only access or object lock. Ransomware deletes any backup it can reach.
- restic and BorgBackup both handle encryption, de-duplication and retention.
- Keep a clear retention rule, such as 7 daily, 4 weekly and 6 monthly.
- Test a restore on a schedule and time it. A backup you have never restored is only a guess.
restic -r s3:s3.amazonaws.com/your-bucket/app-01 init
restic -r s3:s3.amazonaws.com/your-bucket/app-01 backup /etc /var/www /var/backups/mysql
restic -r s3:s3.amazonaws.com/your-bucket/app-01 check- Run the
forget --keep-daily 7 --keep-weekly 4 --keep-monthly 6 --pruneclean-up from a separate trusted machine, not from the server, so the server’s own key can never delete backups.
12. Verify before go-live
Save this as prod-check.sh and run it with sudo bash prod-check.sh. It prints PASS or FAIL for each check.
#!/usr/bin/env bash
# Exits 1 if any check fails.
set -u
[ "$(id -u)" -eq 0 ] || { echo "Run with sudo"; exit 1; }
failed=0
check() {
local name=$1; shift
if "$@" >/dev/null 2>&1; then echo "PASS $name"; else echo "FAIL $name"; failed=1; fi
}
no_reboot() { [ ! -f /var/run/reboot-required ]; }
ufw_active() { ufw status | grep -q '^Status: active'; }
ssh_setting() { sshd -T | grep -qix "$1"; }
ssh_port() { sshd -T | awk '$1 == "port" {print $2; exit}'; }
ssh_not_open() { ! ufw status | grep -Eq "^($(ssh_port)(/tcp)?|OpenSSH) +(ALLOW|LIMIT) +Anywhere"; }
clock_synced() { [ "$(timedatectl show -p NTPSynchronized --value)" = yes ]; }
auto_updates() { apt-config dump APT::Periodic::Unattended-Upgrade | grep -q '"1"'; }
no_empty_pw() { ! awk -F: '$2 == "" {found=1} END {exit !found}' /etc/shadow; }
usage_ok() { [ "$(df "$1" / | awk 'NR==2 {print $5 + 0}')" -lt 80 ]; }
check "No reboot pending" no_reboot
check "UFW active" ufw_active
check "SSH not open to everyone" ssh_not_open
check "SSH root login off" ssh_setting "permitrootlogin no"
check "SSH passwords off" ssh_setting "passwordauthentication no"
check "SSH keyboard-interactive off" ssh_setting "kbdinteractiveauthentication no"
check "fail2ban sshd jail" fail2ban-client status sshd
check "auditd running" systemctl is-active auditd
check "AppArmor enabled" aa-enabled --quiet
check "Clock synchronised" clock_synced
check "Automatic updates on" auto_updates
check "No empty passwords" no_empty_pw
check "Root disk under 80%" usage_ok -P
check "Root inodes under 80%" usage_ok -Pi
exit "$failed"- “SSH not open to everyone” reads the real SSH port from sshd, so it still works if you moved SSH to another port. It fails if you chose the rate-limit fallback in section 4. That is expected. It is there to remind you.
Then run these outside checks:
sudo apt install -y lynis && sudo lynis audit system. Read the warnings and suggestions, not only the score.ssh-audit -p 2222 app-01.example.comfrom your own machine.- CIS has published a benchmark for Ubuntu 26.04. Ubuntu Security Guide (USG, part of Ubuntu Pro) can audit against CIS, but its 26.04 profile was still listed as planned in late October 2026. Run
sudo pro enable usg && sudo apt install -y usg && sudo usg listto see if it has arrived. Always runusg auditbeforeusg fix, and tryfixon a test server first.
Common questions
Is a fresh Ubuntu 26.04 server secure by default?
Partly. AppArmor is on, time sync is authenticated and the root password is locked. But the firewall is off, SSH may accept passwords on some images, and nothing is backed up or monitored.
Should I allow SSH from any IP address?
Avoid it if you can. Allow only your own fixed IP addresses or VPN range. If you cannot, use keys only, a UFW rate limit and fail2ban, and accept that your logs will be noisy.
Should I change the SSH port?
Yes, this guide moves it to 2222. It stops most bot probing and keeps the logs quiet. It is not real protection by itself, though. Keys only and an IP allow list matter far more.
Do I need fail2ban if SSH only accepts keys?
It matters less, because nobody can guess a key. It still keeps logs clean and is ready for web jails. OpenSSH 10 also slows repeat offenders by itself.
UFW or my provider's firewall?
Use both. The provider firewall drops traffic before it reaches the server. UFW still protects you if someone changes the provider rule.
Should I upgrade my 24.04 servers to 26.04.1 now?
There is no rush, because 24.04 is supported until 2029. Test the upgrade on a copy first. Then run this checklist again, because an upgraded server keeps some old defaults, such as the old time sync service.
How often should I run this checklist?
Before go-live, after every release upgrade, and every three months. Run the readiness script and Lynis each time.
Related reading
Need a second pair of eyes on a production server or Magento stack? Get in touch.