How to Make Debian Automatically Update Security Updates

Take Your Linux Skills to the Next Level All courses, certifications, ad-free articles & community — from $8/mo
Join Root →
Ad-free access to all premium articles
Access to all courses: Learn Linux, AI for Linux, Bash Scripting, Ubuntu Handbook, Golang and more.
Access to Linux certifications (RHCSA, RHCE, LFCS and LFCA)
Access new courses on release
Get access to weekly newsletter
Priority help in comments
Private Telegram community
Connect with the Linux community
From $8/mo · or $59/yr billed annually · Cancel anytime

Keeping your system secure is essential, and Debian makes it easy to stay protected with automatic security updates.

In this guide, we’ll walk you through the simple steps to set up your Debian system so it takes care of security updates for you, automatically!

Why Enable Automatic Security Updates?

You’re busy working or enjoying your day, and you don’t have time to manually check for security updates. Meanwhile, new vulnerabilities could be putting your system at risk.

By enabling automatic updates, you can:

  • Stay secure without constant monitoring.
  • Save time by letting your system handle updates.
  • Enjoy peace of mind, knowing your system is always protected.

Regular security updates patch vulnerabilities that could otherwise be exploited by attackers, which is especially important for servers and systems exposed to the internet, where threats evolve constantly.

Step 1: Update Your Debian System

Before making any changes, make sure to run the following apt command to update the package lists and upgrade any outdated packages, which is important to keep your system up to date before enabling automatic updates for a smooth configuration process.

sudo apt update && sudo apt upgrade -y
Update Debian Packages
Update Debian Packages

Step 2: Install the Unattended-Upgrades Package

Debian has a handy tool called unattended-upgrades, which is specifically designed to handle downloading and installing updates without user intervention, which is lightweight and works seamlessly in the background.

sudo apt install unattended-upgrades -y
Install Unattended-Upgrades on Debian
Install Unattended-Upgrades on Debian

Step 3: Enable Automatic Updates on Debian

Once installed, enable automatic updates with the following command, which will prompt asking if you want to enable automatic updates. Select Yes and press Enter, which will confirm that the unattended-upgrades service is active and ready to manage updates for you.

sudo dpkg-reconfigure unattended-upgrades
Configure Unattended-Upgrades on Debian
Configure Unattended-Upgrades on Debian

Step 4: Schedule Automatic Updates on Debian

By default, unattended-upgrades runs daily, to verify or modify the schedule, check the systemd timer:

sudo systemctl status apt-daily.timer
sudo systemctl status apt-daily-upgrade.timer

Both timers should be active, if not, activate them with:

sudo systemctl enable --now apt-daily.timer
sudo systemctl enable --now apt-daily-upgrade.timer

These timers ensure that updates are checked and applied regularly, without manual intervention.

Check Unattended-Upgrades Status
Check Unattended-Upgrades Status

Step 5: Test Automatic Updates on Debian

To ensure everything is working, simulate an unattended upgrade:

sudo unattended-upgrade --dry-run

This command shows what would happen during an automatic update, without actually making changes. It’s a good way to confirm that your configuration is correct and updates will be applied as expected.

You can monitor automatic updates by checking the logs.

sudo less /var/log/unattended-upgrades/unattended-upgrades.log

This log shows details of installed updates and any issues that occurred. Reviewing logs periodically can help you ensure that updates are being applied correctly and troubleshoot any problems.

Monitor Automatic Updates Logs
Monitor Automatic Updates Logs

Advanced Configuration Options

If you’re a power user or managing multiple systems, you might want to explore these additional settings in the configuration file:

sudo nano /etc/apt/apt.conf.d/50unattended-upgrades

Configure unattended-upgrades to send you an email whenever updates are installed.

Unattended-Upgrade::Mail "[email protected]";

Enable automatic reboots after kernel updates by adding this line:

Unattended-Upgrade::Automatic-Reboot "true";

You can also schedule reboots at a specific time:

Unattended-Upgrade::Automatic-Reboot-Time "02:00";

Specify packages you don’t want to be updated by editing the Unattended-Upgrade::Package-Blacklist section in the configuration file.

Configure download limits if you’re on a metered connection by setting options in /etc/apt/apt.conf.d/20auto-upgrades.

Conclusion

That’s it! With these steps, your Debian system will automatically handle security updates, keeping your system secure without you having to do a thing. You’ve now set up a reliable way to ensure your system stays protected from vulnerabilities.

Root Plan
Premium Linux Education for Serious Learners

Take Your Linux Skills to the Next Level

Root members get full access to every course, certification prep track, and a growing library of hands-on Linux content — with new courses added every month.

What You Get
Ad-free access to all premium articles
Access to all courses: Learn Linux, AI for Linux, Bash Scripting, Ubuntu Handbook, Golang and more.
Access to Linux certifications (RHCSA, RHCE, LFCS and LFCA)
Access new courses on release
Get access to weekly newsletter
Priority help in comments
Private Telegram community
Connect with the Linux community
Ravi Saive
I'm Ravi Saive, an award-winning entrepreneur and founder of several successful 5-figure online businesses, including TecMint.com, GeeksMint.com, UbuntuMint.com, and the premium learning hub Pro.Tecmint.com.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.

Root Plan Premium Linux Education for Serious Learners

Before You Go - Upgrade Your Linux Skills

Root members get everything in one place, with new courses added every month.

What You Get
Ad-free access to all premium articles
Access to all courses: Learn Linux, AI for Linux, Bash Scripting, Ubuntu Handbook, Golang and more.
Linux certifications: RHCSA, RHCE, LFCS and LFCA
Access new courses on release
Weekly newsletter, priority support & Telegram community
Join Root Today and Start Learning Linux the Right Way
Structured courses, certification prep, and a community of Linux professionals - all in one membership.
Join Root Plan →
$8/mo · or $59/yr billed annually