User Tools

Site Tools


Forwarding root mail

You may want so forward mail that has been sent to the user root to other users, since you do not want to log in as root and read your mails on the console ;-)

Here I write about forwarding mail to another account or even an external email address using postfix. For other MTAs it might be similar, but I don't use them, so I cannot write about them :-)

Forwarding mails requires an entry in the aliases file. You can ask postfix where this file is:

postconf alias_maps
alias_maps = hash:/etc/aliases

So you have to edit /etc/aliases to add the user name as an alias for root, like

root:	bob


root:	bob, \root

which will cause that mail is still delivered to user root, plus to user bob. You can even add a regular email address here, like

root:, bob, \root

and the mail is sent to three addresses :-) Note the colon after the original recipient's name, and say thanks to good old sendmail for this :-). After editing /etc/aliases, you have to execute the


command to create the correct /etc/aliases.db from the text file. As a last step, you should inform postfix about the changes by executing

/etc/init.d/postfix reload

which traditionally causes postfix to reload all config. The next mail that is sent to root will go to all addresses specified – goal achieved :-D

comp/en/rootmail.txt · Last modified: 2012-10-02 15:38 by werner

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki