Tuesday 8 April 2014

Local mail in Linux and Mutt

Linux has a local mail system, it probably won't be of much interest to you in terms of day to day email since you probably have email set up with your ISP, Yahoo, Google, etc.

One thing that you may be interested in is administrative alerts that are sent to the root mailbox, invalid password attempts, results of cron jobs, etc.

I found the easiest way to view this mail is to install mutt, I'm currently running Linux Mint 16 but the process detailed below will be the same for other versions, Ubuntu, Debian and their derivatives.

Firstly install mutt:

$ sudo apt-get install mutt

Any time that you want to view root's email just type:

$ sudo mutt

You will then see the root mailbox. You might find your own mailbox is inaccessible, probably because it doesn't exist yet :-) This is easily remedied with a few simple command

Assuming your username is "jones", we create an empty file of that name:

$ sudo touch /var/mail/jones

Then we want to make sure that jones can use it, so assign ownership to yourself:

$ sudo chown jones /var/mail/jones

Now you own, you can change the permission so that only you can use it.

$ chmod 600  /var/mail/jones

Now you can use mutt yourself.

No comments:

Post a Comment