3

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?

Thanks.

5
+50

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.

0

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

root:   me@someplace.else.com,someone.else@different.place.com

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? – maxschlepzig Feb 9 '11 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.