how to change daily cron emails to go to user account instead of root

Bernt Hansson bah at bananmonarki.se
Fri Aug 28 10:34:30 UTC 2015


On 2015-08-27 17:53, Chad J. Milios wrote:
> 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.
>

Just run make install && make restart, and off you go.

> see also:
>
> man 5 aliases
> man 1 newaliases


More information about the freebsd-questions mailing list