Pages

2.19.2013

Send root's mail to someone else using aliases

PURPOSE:
This is helpful if you want the root account's mail to go to another system or email address. 

ENVIRONMENT:
  • Centos 6
  • 2.6.32-279.22.1.el6.i686
  • postfix-2.6.6-2.2.el6_1.i686

PROCEDURES:
First things first make sure that postfix is configured correctly for root to send recieve mail. 

See this post about configuring postfix to relay mail through gmail:
http://systemstuds.blogspot.com/2013/02/postfix-configured-to-send-mail-through.html

Now that you have postfix set up correctly run: vi /etc/aliases

Press: shift+g (this vi trick will take you to the last line of the file)

Press: o (this will take you into edit mode below the cursor)

Now add a line to look like this: 
root: someemailaddress@gmail.com

Press: :wq (to save an quit the file)

Next, run: newaliases

Newaliases rebuilds the random access data base for the mail aliases file /etc/aliases. It must be run each time this file is changed in order for the change to take effect. (man page)

Finally, test your new configuration:  mail root

You should now see your test mail in your email account.

As always check /var/log/maillog for problems if you didn't recieve the email.

Good Luck!

No comments:

Post a Comment