vixie-cron not sending mail
On 2008-09-05, Grant Edwards <firstname.lastname@example.org> wrote:
> On 2008-09-05, Grant Edwards <email@example.com> wrote:
>> I've set the MAILTO env variable in my crontab, but vixie-cron
>> still isn't sending e-mails. I've verfied that I'm able to
>> send email with /usr/sbin/sendmail (both with and without -t).
>> I re-emerged vixie-cron with the debug USE flag, but it didn't
>> seem to produce any debug info that I can find anywhere.
>> How do I convince vixie-cron to produce some debug output
>> so that I can figure out why it's not sending e-mails?
> I've narrowed it down a little. I'm using msmtp as an MTA. I
> normally don't have a global /etc/msmtprc configuration file
> -- I have per-user ~/.msmtprc files. I first assumed that
> cron was sending mail as the owner of the cron file (that
> owner has a working msmtp config file). That appears not to
> be true.
> Next, I tried setting up msmtp config files for users root and
> cron. Both those configurations work fine. But, cron still
> can't send mail.
It turns out that cron is attempting to send e-mail with
uid/gid of crontab file owner, but it has USER=root and
HOME=/root. That breaks /usr/sbin/sendmail (msmtp) since it
can't read /root/.msmtprc when it's run as the crontab file
I tried setting HOME appropriately in the crontab file, but
that didn't do anything -- HOME as seen by /usr/sbin/sendmail
is still always /root. [IMO, this is a bug in vixie-cron.]
A paritial work-around is to create a new user and group (I
called it "msmtp". The msmtp binary is set to run suid as the
msmtp user, and the global config file /etc/msmtprc is readable
only by user msmtp. /usr/bin/msmtp is then set to be
executable only by users in the msmtp group, and users who are
allowed to send mail are added to the msmtp group.
This isn't really a general solution since when user FOO runs
msmtp, it won't be able to read ~FOO/.msmtprc as it should
unless ~FOO/.msmtprc is made readible to the msmtp user or
Grant Edwards grante Yow! Somewhere in Tenafly,
at New Jersey, a chiropractor
visi.com is viewing "Leave it to