Redirecting root email

Redirecting root email on a self-administered computer

If you have a computer you administer yourself, either as a desktop (staff and postgrads only) or as a laptop you connect to the CSE wireless network (all users) then it is possible that one day you will receive email from one of the CSG system administrators telling you to redirect root email on the computer to yourself instead of root@cse. What is happening? CSG's experience is that such computers are almost always running some version of linux. Many linux applications send email to the root account instead of, or in addition to, logging their results via syslogd. The default MTA is usually Sendmail. If you have not configured your Sendmail to send root email to yourself or to the local root account only then the email will be sent out onto the CSE network. Apart from the very few computers with their own MX record in CSE's DNS, the mailserver for your computer while it's connected to the CSE network is the CSE mailserver which delivers all email addressed to root to the CSG system administrators. Fortunately, configuring Sendmail to direct root email to you or some address you choose is usually very simple; either of the following work for most users:
  • create a /root/.forward file containing the email address (strictly speaking, a mailbox) you want root email to go to. It's easiest to make this a local account i.e. it exists on your computer and is delivered without ever leaving localhost. If root's homedir isn't /root substitute root's $HOME
  • edit /etc/aliases to point root to the email address you want root email to go to, then run newaliases
Sometimes these measures do not work and you need to force Sendmail to deliver the mail locally. Two ways of doing this (you may need to do both) are:
  • prepend a '\' to the email address you want root mail to go to
  • force localhost.localdomain to be handled locally by adding localhost.localdomain to /etc/mail/local-host-names
The Sendmail FAQ has notes on how you can test these changes are working correctly. If these do not work, you will need to consult the documentation for your particular setup. For Fedora modify /etc/mail/local-host-names and add (just to be safe): localhost localhost.localdomain host host.ai.cse.unsw.edu.au (if you have your own subdomain) host.cse.unsw.edu.au
Last edited by Computing Support Group 28/10/2010

Tags for this page:

redirecting, root, email