Forward System Emails
Linux servers generate emails on a daily (or even hourly) basis, reporting the system's health. These emails are addressed to the local 'root' account. They can be read by any number of local mail readers.
Linux provides a few mechanisms for forwarding these emails to 'root' (and for that matter to any local address). Below are the two simplest methods to set up forwarding. Note that SENDMAIL MUST be running, and port 25 must NOT be blocked. Many ISPs block sending on port 25 (to limit spamming), so you may not be able to forward to an external mail account like firstname.lastname@example.org. Port 587 is the accepted alternative to port 25. A separate page will show how to alter sendmail to use port 587 or to operate with a 'Smart Host' to work around this roadblock.
Method 1: The .forward file
This is the easiest method for a simple forward. As root, use your favorite editor to create the file, /root/.forward with the single line:
Or for multiple copies, space separate the address:
Any user can have their own .forward file.
Method 2: The aliases file
Edit the /etc/aliases file. There is an comment example at the end of the file for forwarding mail for 'root'; you can simply edit this line. You MUST be logged in as root (or use su or sudo) to edit the aliases file. Root can add a forward for any local user to the aliases file. After the changes are made to the aliases file, they are actuated with the command:
In the scheme of things, the /etc/aliases file is processed before the ~/.forward file.