When does Linux send a root mail and how to force it for testing purposes?

16,339

Solution 1

I understand that you want the system to write an email to root, do it like this:

echo "Test" | mail -s "Test " root

Q: And furthermore on which events does Linux send root mails at all?

That depends entirely on your configuration.

Solution 2

To answer upon which events. This is very common from root's cron jobs that produce output. In recent times a lot of admins are receiving the MySQL warning about command line credential use.....

These can be sent to root, but root's mail can be redirected to an alias.

Further, any script run by root might send mail explicitly, although utility accounts are advised for this sort of thing. Logwatch, Fail2Ban, Denyhosts and any number of serious exceptions might warrant an email, an asynchronous and somewhat passive notification.

Share:
16,339
JohnnyFromBF
Author by

JohnnyFromBF

Updated on September 18, 2022

Comments

  • JohnnyFromBF
    JohnnyFromBF over 1 year

    Let's say I want to test root mail functionality after I set up nullmailer, how do I force my Debian Linux system to send a root mail?

    And furthermore on which events does Linux send root mails at all?