LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-19-2022, 07:51 PM   #1
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Rep: Reputation: 21
crontab MAILTO sending to local root instead of remote address specified


I've spent months trying to figure this out. I'm hoping someone here can help shed some light on what's happening.

So I have a mail server setup on my domain at mail.mydomain.vpn on a RaspPi3 running Raspbian-Buster; Postfix/Dovecot w/ Postgresql for tables like virtual users etc. It's been working great; it hosts a few mailboxes for my internal domain/vpn.
I have another box, box1.mydomain.vpn; also a RaspPi3 that I've setup to send cron job emails to an account (me@mydomain.vpn) hosted on mail.mydomain.vpn. It has postfix installed and configured to relay to mail.mydomain.vpn. Again, it works great.

Now I have my Slackware box (box2.mydomain.vpn). I also want to have cron job results emailed to me at the same address (me@mydomain.vpn) via a relay to mail.mydomain.vpn.
I added the same MAILTO=me@mydomain.vpn that I have on box1.mydomain.vpn to my crontab (for root).
I initially tried using sendmail on this box and spent time figuring out how to add my relay host and other configurations for it to send to mail.mydomain.vpn.
I came across some DNS issues; the MX for mydomain.vpn was pointing to the wrong IP for example.
I tried sendmail -bv me@mydomain.vpn and it came back ok.
I try sending test messages via sendmail and they all appear in my me@mydomain.vpn Inbox.
I then decided that maybe I needed to use postfix instead; it seemed to work on box1. So I switched over to Postfix, making sure to go through my main.cf and master.cf settings; encountering some issues with chrooting, etc. Seemed to get that all ironed out.

Despite all this, what seems to be happening based on what I'm seeing in my logs on mail.mydomain.vpn, is that sendmail/postfix does successfully connect, but for some reason with the crontab emails, it's being addressed to 'root@box2.mydomain.vpn' instead of 'me@mydomain.vpn'.
I recently combed through my postfix logs on mail.mydomain.vpn and noticed that the RCPT TO is set to root@box2.mydomain.vpn; so it's definitely a case where cron is addressing the message to the wrong address.

But why? I have a feeling I've overlooked something that doesn't apply to Debian; I never had this problem getting this working on any of my Raspbian boxes.

Can anyone help me out?

Thanks!
 
Old 04-19-2022, 10:04 PM   #2
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Original Poster
Rep: Reputation: 21
So, a brief update:
I looked at my cron logs and found this...
Code:
failed parsing crontab for user root: MAILTO="me@mydomain.vpn"
...which I assume means it then defaults to the cron job owner; in this case 'root'. So that makes sense.

But why is this incorrect?

After a little more digging the only difference I see between my Raspbian & Slackware boxes are that Slackware uses 'dcron' whereas Raspbian uses 'cron'; the former has crond, whereas the latter is just cron.
Is MAILTO only supported by 'cron' and not 'dcron'?
 
Old 04-20-2022, 09:32 PM   #3
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Original Poster
Rep: Reputation: 21
So it appears that my lead about Slackware dcron vs Debian cron has some truth to it(?)
The two are indeed different implementations of cron, and it *appears* that dcron doesn't utilize MAILTO from within crontab.

The solution was to append '-m me@mydomain.vpn' to CROND_OPTS in /etc/default/crond

As soon as I did that, the expected cron job emails started arriving.

Figured I'd post a solution here in case someone comes along in the future with the same problem/questions.
 
4 members found this post helpful.
  


Reply

Tags
crontab, email, postfix, slackware



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Logwatch not sending email to my @gmail instead the mail log showing local account? newbie14 Linux - Security 3 08-23-2020 09:41 PM
Geting Remote IP address from Remote MAC Address hareshmv Linux - Networking 3 05-09-2012 05:48 PM
crond problem,after success run the job,will mailto root singying304 Linux - Software 1 11-29-2005 05:33 PM
How to find MAC address of a specified IP address ? longtongfish Programming 1 07-12-2005 03:26 PM
crontab MAILTO and config problems staul Linux - Software 1 04-09-2005 04:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration