Contents[Show]

1. Intro

Most linux systems can send system messages to the root account, which is all and well. However, for practical purposes it's easier if the mails would be sent to a mail account you monitor frequently.

This is what this short article will review.

I have a personal internet domain that also has a mail forwarding service. I will use that service for the purpose of sending root system messages to my This email address is being protected from spambots. You need JavaScript enabled to view it. account.

 

 

2. Assumptions

I use Ubuntu-Mate 19.10 Eoan Ermine on my personal admin-workstation at home.

Postfix is installed. If it isn't, install it like this.

$ sudo apt install postfix

 

 

3. Howto

  1. Edit /etc/aliases. You should see a few lines there with postmaster: root. Add a new line as below, pointing to your external mail address.
    For future purposes you might also want to add your own local user account to this list.
    $ sudo nano /etc/aliases

    postmaster: root
    sorin: root

    root: This email address is being protected from spambots. You need JavaScript enabled to view it.
  2. Run the newaliases command to make post aware of the new alias. 
    # newaliases
    /etc/aliases: 77 aliases, longest 17 bytes, 792 bytes total
  3.  Restart the postfix daemon for good measure.
    # service postfix restart
  4. Send a test mail.
    $ echo "Subject: sendmail test" | sendmail -v This email address is being protected from spambots. You need JavaScript enabled to view it.
  5. Check your mailer to see if the mail shows up there.
    All okay? Congrats, it's working!

 

 

4. Sources

https://serverfault.com/questions/243669/procedure-to-forward-root-email-to-external-email

Testing sendmail in linux