|
|
|
Use Evolution to read local mailbox |
PDF
|
| Print |
|
E-mail
|
|
Written by Kanwar Ranbir Sandhu
|
|
Thursday, 14 April 2005 |
How do you as a normal user, running a plain old Fedora Core desktop, read
root's local mail? It's easier than you think.
When you install a Red Hat based GNU/Linux distribution, one of the
packages installed by default is Sendmail. This is done so that system messages can be delivered
to the root user.
Some of the messages root receives includes messages like disk usage,
remote login attempts, and errors, all aggregated by Logwatch.
As alluded to here, Logwatch is a system
log analyzer and reporter. Here's an excerpt from the Logwatch
man page:
"LogWatch is a customizable, pluggable log-monitoring system. It
will go through your logs for a given period of time and make a report
in the areas that you wish with the detail that you wish.
Easy to use - works right out of the package on almost all systems."
This is great: a program that can look through the logs YOU want, HOW
you want, and then report the bits you're interested in. The
keyword here is "report". In order to do so, Logwatch mails the
report to the root user, which is why Sendmail is installed by
default, even on a desktop configuration.
As long as you don't turn off the Sendmail service or remove the
package all together, Logwatch will make its daily run, and then send a
report to root's local mailbox in /var/spool/mail/root. A normal
user cannot read root's email, but you can configure your system to
have any and all messages destined to root to be diverted (i.e. aliased) to your local
mailbox instead.
You'll have to complete a two stage process in order to receive root's email in your Evolution Inbox. Here's what you do:
Stage 1
- Assuming you're running X, start a GNOME Terminal. You can find this in the System Tools menu under Applications.
- Since you have to make changes to a system file, you'll have to login as the root user. Type the following:
$ su -
Hit enter after typing the dash.
You'll be
prompted to enter root's password. Go ahead and type it in, then
hit enter again. You'll know you're logged in as the root user by
the change in the prompt from a "$" to a "#".
- At the moment Logwatch sends email to root's local mailbox.
We want to alias it to our local mailbox. To do that, we have to
edit the file /etc/aliases. You can use any editor you
want. For example:
# vi /etc/aliases
- You'll now be looking at the file Sendmail uses to figure out
which recepient to send email to for local users. You'll notice
that a default /etc/aliases file is setup to send all mail to the root
user.
Scroll down to the bottom of the file. You should now see a line similar to the following on your screen:
# Person who should get root's mail
# root:
(The hashes here represents the beginning of a comment in the file.)
- Using alias lines in the rest of the file as a guideline for
format, type in your local user ID. For example, if your user ID
is "parminder", you would enter the following:
# Person who should get root's mail
root: parminder
What this will do is redirect all messages destined for root's mailbox
to your local mailbox. In this example, messages will now be
delivered to the user, parminder, here:
/var/spool/mail/parminder
- Save your changes and exit the editor.
- Sendmail has to be made aware of the changes made to
/etc/aliases. There's a special command to do just that. In
your GNOME Terminal, enter the following:
# newaliases
This will rebuild the aliases database.
- Type exit:
# exit
- Type exit again to close the GNOME Terminal:
$ exit
Stage 2
Now that root's email is aliased to your local mailbox, you need to configure Evolution to read the messages.
- Start Evolution.
- Go to Tools -> Settings.
- Click Mail Accounts.
- Click Add.
- Click Forward.
- Type in a name in the "Full Name" field.
- For the Email Address field, type in your login ID followed by @localhost. For example:
parminder@localhost
- Click Forward.
- Click on the drop down list box and select "Local delivery".
- If the "Path" field in the Configuration section isn't already
filled in, you'll need to type in the location of your local
mailbox. Using the login ID from above as an example, here's what
would be entered:
/var/spool/mail/parminder
- Click Forward.
- If you like, you can setup Evolution to automatically check this mail account.
- Click Forward.
- You're
not going to be sending mail with this account, so you could just leave
everything alone in the Sending Email window. However, I change
the "Server Type" to Sendmail.
- Click Forward.
- Finally, enter a name for the mail account. The name "Local Messages" is a good choice.
- Click Forward.
- Click Apply.
You're done! You'll notice in the Mail Account window that
the Protocol listed for your new mail account is "mbox". This
indicates that Evolution will be managing your local mailbox.
Now when your system sends messages to the root user, Sendmail will use
the alias you defined in /etc/aliases to deliver the mail to your local
mailbox. Your Logwatch reports should now be picked up
by Evolution for you to review.
You can of course use any mail application to do this, so try Stage 2 with another client, such as Thunderbird.
I hope that was helpful. Enjoy!
Resources
man pages
- logwatch
- aliases
- sendmail
- newaliases
|
|
Last Updated ( Saturday, 23 April 2005 )
|
|
|
|