How to forward email notification received by root to your email address

The system sends email notifications to /var/mail/root and to any other user if its configured.

You can easily forward these notifications to your email address and don't have to check the server every time. Here's how:

Login to the Linux box and run the following commands as root:

open the aliases file

vi /etc/aliases

At the very bottom you will see the entry as under:

# Person who should get root's mail

#root:          marc

Change it to:

root:          youremail@yourdomain.com

Close this file and run the newaliases command

newaliases

Restart the postfix service (or anything MTA that is configured)

service postfix restart

test it by sending an email to root

echo test | mail -s "test message" root

check the mail log to confirm

tail -f /var/log/maillog

That's all!