how to change daily cron emails to go to user account instead of root
Chad J. Milios
milios at ccsys.com
Thu Aug 27 16:03:12 UTC 2015
This thread has many good answers to more finely control things like periodic’s output or cron’s output or one cron entry’s output but I have not seen the simplest and most general answer.
see the first few lines of /etc/mail/aliases (or if you don’t use the sendmail in base, maybe /usr/local/etc/postfix/aliases or the equivalent for your mail system):
# Pretty much everything else in this file points to "root", so
# you would do well in either reading root's mailbox or forwarding
# root's email from here.
# root: me at my.domain
you uncomment that "root:" line there and obviously replace "me at my.domain" with something along the lines of "you at your.domain” to mail off-system or just “you" to redirect to a different on-system user. (root account shouldn’t be running any mail reader software that’s any more complex than `cat /var/mail/root` and even that I wouldn’t get into the habit of doing)
THEN after you change that file you MUST run the `newaliases` command (or `postalias /usr/local/etc/postfix/aliases` in the case of postfix) because a database file is actually what handles lookups after it is [re-]generated from that text file.
man 5 aliases
man 1 newaliases
> On Aug 27, 2015, at 8:41 AM, Ernie Luzar <luzar722 at gmail.com> wrote:
> Hello list;
> How do I change the daily cron emails to go to user account instead of root? I don't want any cron email going to root any more.
> man 5 crontab says the cron environment variable MAILTO = "account user name" is way to change the cron email from the default of "root" to the "account user name" you want.
> The part that is not clear is where do I place this MAILTO environment variable? Do I edit /etc/crontab and pace it next to the PATH variable or maybe in /etc/periodic.conf or /etc/csh.cshrc or /boot/loader.conf?
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
More information about the freebsd-questions