Linux: Redirect Root Email

Many system services and automated jobs (cron) are setup to send notifications the root email account for the server by default. If you need a way to quickly capture the root email and redirect them to another account, the quick steps below will get this taken care of.

First step is to edit your aliases file located at /etc/aliases using a text editor on your server. Personally I like to use pico/nano. You will need to add the following line to this file:

root: [email protected]
 (replace [email protected] with your real email address) 

Next step after saving the aliases file is to let the server know you have new aliases. This can be done by simply running the newaliases command.

You can test to see if your change is working by running the following command which will send a test email.

echo test | mail -s "test message" root

With that your root email will now go to the email account you defined in the aliases file. These same steps can be performed for any accounts on the server.

Kevin Fairbanks

Kevin Fairbanks serves as the Chief Executive Officer of PinkTie Technology Group, LLC – a website development and digital marketing agency. Kevin runs the Veteran Entrepreneur Mastermind where he helps bring Veterans together to discuss business ownership. He’s involved in several community organization including serving as a board member for the Greater Cicero Chamber of Commerce. As the host of a weekly podcast, Remove Before Flight, Kevin teaches Veterans how to start, grow, or scale a business.

Short of being a father, serving in the United States Air Force was the most important period in Kevin’s life. It reinforced who he is today and complimented the values taught to him growing up by his parents.

During his service time, Kevin had the pleasure of traveling the world and seeing how other cultures lived both pleasant and unpleasant. During one of these missions he experienced injuries that ultimately led to my honorable discharge as a Service Disabled Veteran.