Change root User Email Address

Easy to ignore the mail notifications on a linux computer/server.

Why not add a forward to the email on the root user to an email address?

Forward File

Simply create the file /root/.forward and place your email address in this file. It will be forwarded to your external mail address.

We can simply create .forward file in the folder root and add an email address there.

# vi /root/.forward

Example content:

system@example.com

Restart the postfix server

# systemctl restart postfix.service

Aliases File

vi /etc/aliases

Add email ids at the bottom of the file.

root: support@example.com

To add multiple email ids, we can simply separate them by comma.

root: support@example.com, hello@example.com

Step 2: Run the aliases command, to compile aliases file. 

newaliases

Step 3: Restart mail server

You may find that the mail server requires a restart to adopt the changes. Shown below, as an example, is the entry for postfix.

systemctl restart postfix.service