Wednesday, September 17, 2008

Linux, consolidate root mail

When operating large numbers of linux servers you also will have by default on every server a mailbox. We just recently made a switch for a large number of server to move to Oracle Enterprise Linux. This made us rethink some things and look again at some problems we have had in the past. One of the 'problems' was that administrators where checking the mails send to root on all the servers.

Now some of the servers are just running with a very long uptime and do not need a lot of maintenance so it could happen that the root mailbox became quite large. Also a lot of messages send to the local root user where overlooked and no action was taken upon the messages because it was not causing any problem. The new approach we chose after switching to Oracle Enterprise Linux was to consolidate all mails into a shared mailbox.

So we are now forwarding all mails that where originaly send to the local mailbox of root to a account root@somedomain.com . To do so you have to make a change in /etc/aliases . Somewhere at the bottom you will most likely find something like:

# Person who should get root's mail
#root: marc

Change this to
# Person who should get root's mail
root: root@somedomain.com

Save the file and type the following command: newaliases
Newaliases rebuilds the random access data base for the mail aliases file /etc/aliases. It must be run each time this file is changed in order for the change to take effect. Newaliases is identical to ‘‘sendmail -bi’’.

You now can test if all is working as expected by sending a mail to user root from the command line. You should receive the mail in your root@somedomain.com mailbox. This way you can consolidate the mails send out by the system and you can more easily get a overview of what is happening on your systems.


No comments: