Ubuntu – By default, what system messages get mailed to root

10.04emailredmineserver

I recently installed ssmtp on my server to enable e-mail notifications for a redmine install. While I was verifying everything was setup correctly I got an e-mail notification about a failed cron job. This turned out to be really helpful and I never would have noticed it had I not set this up.

It's been a few days since and I haven't received any other e-mails from the system. By default, what mail gets sent to root?

Best Answer

By default, cron will mail all output from cron jobs to the owner of the job, whether they fail or not. (Root is the owner of the system cron job, and is configured as the mail destination for non-root daemon cron jobs.) Most system cron jobs are carefully written not to produce output unless something is wrong.

Any other program can send mail to root, but not many will in a default Ubuntu install. Things I have seen include

  • in Debian, some programs will send mail when they are not properly configured, but I have not seen this recently in Ubuntu
  • mdraid sends mail when an array fails or is restored
  • apcupsd sends mail when the machine loses AC power
  • uptimed sends mail when you pass a milestone or record

If you're writing your own cron jobs you can set MAILTO to control where the output is sent. (See also man 5 crontab.)