How to forward all root emails to your external email address Ubuntu?

If the root user is getting mail on your server (for example from cron scripts) then it can really helpful to forward it to an external email address. There are two ways of doing this:

1) The easiest and quickest way is to make a file in the folder called /root/.forward and place your email address in it. Note – this will work for any user.

2) Alternatively you can edit the /etc/aliases and add the following line:

root: me@myemail.com

Then run:

newaliases

Then restart postfix (assuming this is you mta).

service postfix restart

Either way you can then test your configuration but sending an email:

echo test | mail -s "test message" root

p.s. You can install the mail command for this test using apt-get install mailutils 🙂

One thought to “How to forward all root emails to your external email address Ubuntu?”

  1. Tried this with Ubuntu 14.04.2 LTS and it does not work. I get the following message

    smtp-server: 504 5.5.2 : Recipient address rejected: need fully-qualified address
    “/root/dead.letter” 11/310
    . . . message not sent.

Leave a Reply