BRUB menu Ubuntu 14.10

How to configure Ubuntu 14.04 server to forward root mails to your email address

This short tutorial shows how to configure a Ubuntu 14.04 Cloud server to forward system-generated mails sent to the root account to your email address.

Why would you want to forward mails sent to root to an email address?

Because most properly-configured Cloud servers are managed using a (normal) user account with sudo (root) privileges. So unless you switch to root while logged in as a normal user, and then type the mail command, you will not see those emails.

Here, for example, is the output of the mail command after switching to root on one of my servers:

That’s a lot of unread messages. Some of those messages might contain important information about the server, some of which could be the result of cron jobs or from system alerts triggered by unauthorized user activity. For example, here’s the content of one of those emails sent to the root account after an unauthorized (and failed) user activity:

Related Post:  End-to-end Machine Learning with TensorFlow on Google Cloud Platform

Related Post:  Accessing Linux systems remotely

That’s an alert you won’t see if you don’t read emails sent to root. So this tutorial will show you how to configure the server to make it easy for you to read such emails – by sending them to your email address. This tutorial assumes, of course, that you have access to and manage a Cloud server running Ubuntu 14.04.

To forward roots mail to an email address, open the /etc/aliases file with your favorite text editor. The default content should read:

Edit it so that it reads:

That will forward all system-generated emails sent to root to the specified email address. Replace user@methisyou.net with your real email address. Save and close the file, then run the newaliases command to effect the change.

That’s it. If you don’t receive the expected emails, check you Spam folder.

Please share:
Tags: No tags

5 Responses

Add a Comment

Your email address will not be published. Required fields are marked *