Turn on automatic security updates

Let Debian/Ubuntu install security patches on its own with unattended-upgrades.

Linuxupdatesunattended-upgradessecurityaptMedium risk
Run sudo dpkg-reconfigure -plow unattended-upgrades and choose Yes — security patches then install automatically every day.

01Command

Command
$ sudo dpkg-reconfigure -plow unattended-upgrades

02What it does

Unpatched systems are the single most common way home servers get compromised, and unattended-upgrades is the built-in fix: a systemd timer downloads and installs security updates from the distro's security repository daily. The reconfigure command writes the enable flag to /etc/apt/apt.conf.d/20auto-upgrades; check results afterwards in /var/log/unattended-upgrades/. It only auto-installs security (and selected) updates — full upgrades still need apt upgrade.

03Risk

RiskMedium risk
Requirementsunattended-upgrades package (preinstalled on Ubuntu desktop/server; Debian: sudo apt install unattended-upgrades)
!Warning: Automatic updates can restart services mid-use (e.g. your web server); read /var/log/unattended-upgrades/ when something behaves oddly, and remember a kernel update still needs a reboot to take effect.

04Undo

Undo
$ sudo dpkg-reconfigure -plow unattended-upgrades   # choose No to disable

05Sources

  • UnattendedUpgrades — Debian Wiki
    Debian · community · 2026-09-17
    Evidence: dpkg-reconfigure -plow unattended-upgrades interactively enables the daily automatic security update service; the package ships default config enabling the security origin.
  • unattended-upgrade(8) — Ubuntu manual page
    Ubuntu · community · 2026-09-17
    Evidence: unattended-upgrade runs via apt timers to download and install security updates automatically according to its config.

Last verified: 2026-09-18 · Category: Security & Privacy

06Related solutions