Handling System E-mail
Unix servers generate a lot of e-mail, with most of it being sent to the root user's mail account. When you have more than one or two servers, logging into each and checking mail (generally from the command line) is not effective. Instead, it is better to forward all system e-mail to a centralized account which can then be checked via normal procedures, for all servers set up this way.
The postfix smtp server uses the /etc/aliases file to override the “normal” mail targets. Mail destinations are first read from the aliases file and, only if they can not be matched there, are then sent to individual users on the system.
To send all mail destined for the root user, you must first create an alias or an account on a centralized server, then perform the following to redirect mail to the root user to that account.
- Edit /etc/aliases
- Edit or create an entry for the root user. This is a colon separated line, with root on the left, and the actual target on the right.
- Save the aliases file and exit to the command line
- Execute the command newaliases to convert the changes to aliases.db, which is the default hash file used by postfix.
- aliases_addition
root: technicians@example.com
Note that this will forward to whatever server is set up as a relay server in /etc/postfix/main.cf. To use Authenticated Relay, read that article here.