20/04/2026
GNU/Linux notifications via email (part 1)
Five minutes ago I was posting a reply on Reddit about monitoring GNU/Linux systems and I suddenly realized something very basic but extremely useful that most of the people and most of the professional sysadmins ignore: this wonderful OS will tell you everything if you let it talk to you.
In more technical terms, every GNU/Linux distribution out of the box has everything it needs to send you notifications via email if something goes wrong, you don’t have to search anything, you don’t have to parse logs, you don’t have to look for clues.
To reach this objective you only need two things:
- install an MTA (aka an SMTP server)
- configure the OS to forward root emails to your email address
Let’s see how to reach this simple but fundamental goal.
First of all install Postfix as SMTP (forget about Sendmail), to do this you only need to use the OS package managers:
on Debian based distribution use
sudo apt install postfix
on RedHat based distribution use
sudo dnf install postfix
Once done make sure you started Postfix and configured it to start at boot with
sudo systemctl enable --now postfix.service
Ok you’re half of the way, another little step.
Once Postfix is started you have to tell the OS to forward root email to your email address, to do this you only have to put a like like this in the /etc/aliases file
root: [email protected]
If you find a line with only “root:” remove it, or simply change it as the example I wrote before. Obviously change [email protected] with your email address…
Now one last step, saving /etc/aliases with your new alias is not enough, you have to rebuild the aliases database, and then reload Postfix, to do these things you only have to launch this command.
sudo newaliases ; sudo postfix reload
Done, now if you try to send an email to the root user Postfix will forward it to your email address, for example:
echo "lorem ipsum" | mail -s "email test" root
Obviously your server must be able to reach the MX record host of your email address domain on TCP port 25, on top of that if you used a public domain email address you have to face several other problems regarding spam or sender email domain, or SPF validation… but these are topics for another more advanced post.
Make GNU/Linux work for you, end of part 1.


![[ Celebrate 30 years of GNU! ]](https://tasslehoff.burrfoot.it/wp-content/uploads/2013/11/GNU_30th_badge.png)

