I've recently been teaching myself about the BSDs and decided to pick up a NetBSD VPS. I don't always log in to this box every day (it's not actually doing anything that important), but I'd still like to monitor root's mail. To that end, I started looking into how to forward root's mail to an external account. I learned a little about the /etc/aliases file, and it looks like I might be able to build up a pipeline to do this for me, but I'm treading into unfamiliar territory.

Is there a tutorial that covers this sort of thing? Is it even a good idea?



2 Answers 2


You could create a normal user, e.g. juser, and add it to the /etc/aliases file on the right hand side of the root entry.

For normal forwarding of root-mail you would just create a .forward (which contains your external e-mail address) in the home directory of juser.

Regarding encryption you can use a MDA (mail delivery agent for that), e.g. procmail and for that. Instead of a .forward you have to create a .procmailrc file in the home directory of juser in that case.

Via .procmailrc you can pipe a message (header/body) through an external program, e.g. a simple script that basically contains some gpg command. And with the right rule at the end of the procmailrc, you can forward the (processed) message to your external e-mail address.


The catch-all way to do this is to edit the /etc/aliases file:

root:   [email protected],[email protected]

Run newaliases and you should be good to go.

Note you probably have to doctor your MTA (sendmail, or whatever) so that the messages emitted don't get deleted as spam, but that's a larger issue.

  • 4
    And what about the encrypt and sign part of the question? Commented Feb 9, 2011 at 10:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .