Configure Unattended Upgrades for Security in Ubuntu

by Jay

Importance of Unattended Upgrades

Installing and configuring “Unattended Upgrades” is essential for maintaining a secure and well-maintained Linux system, especially for Ubuntu-based distributions. Here’s why it matters:

  • Security: Regularly applying security updates is crucial to safeguard your system against potential threats. Unattended-Upgrades ensures that critical security patches are automatically installed without user intervention.
  • Efficiency: Manual update management can be time-consuming, especially on large-scale deployments. Unattended-Upgrades streamlines the process, reducing administrative overhead.
  • Stability: By focusing on security updates and avoiding other updates that might introduce changes, you maintain a more stable system.

Steps for Installing and Configure Unattended Upgrades

Here are the steps involved in installing and configuring Unattended-Upgrades for security updates:

a. Installation

First, install the Unattended-Upgrades package:

# sudo apt-get install unattended-upgrades

b. Configuration

Configure Unattended-Upgrades to install only security updates by editing its configuration file:

  • Open the configuration file:
    # sudo vi /etc/apt/apt.conf.d/50unattended-upgrades
  • Uncomment the line that specifies “Allowed-Origins,” and set it to include only the “security” repository:
     Unattended-Upgrade::Allowed-Origins {

c. Enable and Start the Service

Enable the Unattended-Upgrades service to make it automatically run and apply security updates:

# sudo systemctl enable unattended-upgrades
# sudo systemctl start unattended-upgrades

Benefits of Configuration

The configuration of Unattended-Upgrades provides several benefits:

  • Security-Only Updates: With the configuration set to the security repository, Unattended-Upgrades focuses solely on security updates, reducing the risk of unexpected changes from non-security updates.
  • Automatic Updates: Once configured, the system will automatically apply security updates, minimizing the window of vulnerability.
  • Ease of Maintenance: The automation provided by Unattended-Upgrades reduces the need for manual intervention and ensures a more consistent and secure system.


While the configuration provided in this guide is focused on security updates, Unattended-Upgrades offers a variety of configuration options.

You can customize it to fit your specific needs, such as controlling the update window, email notifications, and more. Refer to the official documentation and consult best practices for further customization.

By following these steps, you enhance the security and efficiency of your Ubuntu-based system, allowing it to stay current with the latest security patches automatically. It’s a fundamental practice for maintaining a secure and stable environment.

Was this article of use to you? Post your insightful thoughts or recommendations in the comments section if you don’t find this article to be helpful or if you see any outdated information, a problem, or a typo to help this article better.

Related Posts

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.