You are currently viewing 
<span class="bsf-rt-reading-time"><span class="bsf-rt-display-label" prefix="Reading Time"></span> <span class="bsf-rt-display-time" reading_time="4"></span> <span class="bsf-rt-display-postfix" postfix="mins"></span></span><!-- .bsf-rt-reading-time -->How to configure email alerts for Ubuntu auto updates

How to configure email alerts for Ubuntu auto updates

Share the Tech Love

2020-08-13 13:35:06

In the event you’ve configured your Ubuntu servers to robotically set up safety updates, you may wish to observe that up by configuring electronic mail alerts for these upgrades.

IT technician with network equipment and cables

Picture: Getty Pictures/iStockphoto

Just lately I confirmed you How to enable automatic security updates for Ubuntu Server, which might robotically obtain and apply safety updates in your open supply servers. It is a nice setup for anybody that has discovered themselves too busy to verify for and apply updates.

However when one thing goes awry with an replace, you may wish to be alerted to that failure. One of the best route for that’s through electronic mail.

I will present you methods to arrange electronic mail notifications for replace errors. It is not terribly difficult, so you need to be capable to care for this on your entire information middle Ubuntu servers very quickly.

What you will want

  • A working occasion of Ubuntu with automated safety updates configured 
  • A person with sudo privileges

Observe: In the event you’ll be utilizing the Gmail SMTP servers, you’ll need to arrange an app password for Postfix (see: Bypass two-step authentication with app passwords).

SEE: Hiring kit: Network administrator (TechRepublic Premium)

Learn how to set up the mandatory dependencies

To ensure that the server to have the ability to ship out electronic mail alerts, you will want to put in Postfix. To do that, open a terminal window and subject the command:

sudo apt-get set up postfix -y

In the course of the set up of Postfix, you will have to configure it as an web website (Determine A).

Determine A


Configuring Postfix as an web website.

Be certain to pick Web Web site and tab right down to OK. Within the ensuing window, enter the FQDN of your server and tab right down to OK (Determine B).

Determine B


Configuring the FQDN of your server for Postfix.

Learn how to configure Postfix

After the Postfix set up completes, you will have to configure the mail server. The way you do that will rely upon what you are utilizing for an SMTP server. As an example, if in case you have an in-house mail server, you will use the data for that server (together with authentication credentials). In the event you’re utilizing Gmail SMTP servers, you will first have to arrange an app password in your Google account.

As soon as you recognize the specifics of your SMTP server, open the configuration file with the command:

sudo nano /and so forth/postfix/

Search for the road:

relayhost =

You will want to alter that line to replicate your SMTP server. For instance, if you happen to’re utilizing the Gmail SMTP servers, that line could be:

relayhost =

In the event you’re utilizing Gmail as your SMTP server you will wish to configure Postfix to make use of an alternate location for the authentication data (to maintain undesirable eyes from gleaning your credentials). For that, paste the next on the finish of the primary.conf file:

# outbound relay configurations
smtp_sasl_auth_enable = sure
smtp_sasl_password_maps = hash:/and so forth/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = could
header_size_limit = 4096000

Save and shut the file.

Subsequent we’ll create the sasl_passwd file with the command:

sudo nano /and so forth/postfix/sasl/sasl_passwd

In that file paste the next:

[]:587 [email protected]:PASSWORD

The place USERNAME is your Gmail username and PASSWORD is your Gmail app password.

Save and shut the file.

Create the hash db for Postfix with the command:

sudo postmap /and so forth/postfix/sasl/sasl_passwd

Restart Postfix with the command:

sudo systemctl restart postfix

Learn how to configure electronic mail alerts

With Postfix up and working, we will now configure the e-mail alerts. To do that, open the configuration file with the command:

sudo nano /and so forth/apt/apt.conf.d/50unattended-upgrades

In that file, search for the road:

//Unattended-Improve::Mail "root";

Change that line to:

Unattended-Improve::Mail "electronic [email protected]";

The place electronic [email protected] is the e-mail handle you need the e-mail to be despatched from.

In the event you solely wish to be despatched notifications on error, search for the road:

//Unattended-Improve::MailOnlyOnError "true";

Change the above line to:

Unattended-Improve::MailOnlyOnError "true";

Save and shut the file. 

At this level, the system is prepared. The following time an automated safety replace is utilized you can be despatched a notification. If, nonetheless, you’ve got configured this to solely notify on errors, let’s hope you by no means hear from Postfix.

In any other case, you need to really feel a bit higher now that your Ubuntu servers should not solely robotically making use of safety updates, however they will be notifying you when it occurs or when an improve fails. 

Additionally see

Supply Hyperlink