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
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
Howto
- 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. - Run the newaliases command to make post aware of the new alias.
# newaliases
/etc/aliases: 77 aliases, longest 17 bytes, 792 bytes total - Restart the postfix daemon for good measure.
# service postfix restart
- 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. - Check your mailer to see if the mail shows up there.
All okay? Congrats, it's working!
Sources
https://serverfault.com/questions/243669/procedure-to-forward-root-email-to-external-email