Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Aug 2015 11:53:56 -0400
From:      "Chad J. Milios" <milios@ccsys.com>
To:        Ernie Luzar <luzar722@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: how to change daily cron emails to go to user account instead of root
Message-ID:  <21C31935-454C-4E97-8230-7059E8EAFF39@ccsys.com>
In-Reply-To: <55DF057F.6040205@gmail.com>
References:  <55DF057F.6040205@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This thread has many good answers to more finely control things like =
periodic=E2=80=99s output or cron=E2=80=99s output or one cron entry=E2=80=
=99s 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=E2=80=99t =
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@my.domain

you uncomment that "root:" line there and obviously replace =
"me@my.domain" with something along the lines of "you@your.domain=E2=80=9D=
 to mail off-system or just =E2=80=9Cyou" to redirect to a different =
on-system user. (root account shouldn=E2=80=99t be running any mail =
reader software that=E2=80=99s any more complex than `cat =
/var/mail/root` and even that I wouldn=E2=80=99t 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.

see also:

man 5 aliases
man 1 newaliases


> On Aug 27, 2015, at 8:41 AM, Ernie Luzar <luzar722@gmail.com> wrote:
>=20
> Hello list;
>=20
> 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.
>=20
> man 5 crontab says the cron environment variable MAILTO =3D "account =
user name" is way to change the cron email from the default of "root" to =
the "account user name" you want.
>=20
> 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?
>=20
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to =
"freebsd-questions-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?21C31935-454C-4E97-8230-7059E8EAFF39>