This page was last modified: December 16 2007 17:59:55   
Too Cool for Internet Explorer

Reading local mail

Logwatch is a program that reports important information to the root user based on log files. The information is send by mail to root, which is why Sendmail is installed even on a desktop installation. This is all done by default without any intervention from your side. But it is of cause completely pointless if you don't read the mail.

You can read the mail sent to root from the commandline, but it is far more convenient to use your email client. The following explains how to do it with Evolution, since this is the email client I am using.

Using the root account for common desktop work is not recommended - mainly for securit reasons. So most people have a normal user account besides the root account. Let's say that the user account is named 'fiona'. The fiona account can't read roots mail directly, so we have do direct roots mail to fiona.:

Open a terminal and become root, then go to /etc:

$ su -
Password:
# cd /etc/

In the /etc directory you'll find a file named aliases. Open it using your favorite text editor. Scroll down until you reach this part:

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

Remove the # character in front of root: and add the name of the user who should receive roots mail. For example, if the receiving user is named fiona, the line must look like this.:

root: fiona

Save and close the aliases file. Then rebuild the aliases database by running the newaliases command:

# newaliases

If sendmail don't recognize the senders domain name, mail from the system will bounce. To prevent this, you need to check that "localhost.localdomain" is configured correctly in /etc/hosts:

::1 localhost.localdomain localhost
127.0.0.1 localhost.localdomain localhost

Make sure that the domains added for ::1 and 127.0.0.1 are identical.

Next you need to setup an account in Evolution which is used to read the mail:

  • Start Evolution and choose Edit -> Preferences
  • Select "Mail Account" and click the "Add" button.
  • The wizards welcome message shows, click "Forward"
  • Write your name in the "Full name" field and type fiona@localhost in the "Email address" field (remember to replace fiona with your username). Click "Forward".
  • In "Server Type" choose "Standard Unix mbox spool file". In "Path" click the button and navigate to /var/spool/mail/fiona (where fiona should be your username). Click "Forward".
  • Put a checkmark in "Automatically check for new messages". Click "Forward".
  • In "Server Type" choose "Sendmail", but leave the rest as is, since you wont be sending mail from this account. Click "Forward".
  • In the "Name" field type a name of your own choice like "Local mail". Click "Forward".
  • Your done... just click "Apply".