Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #160570 > unrolled thread
| Started by | Kynn Jones <kynnjo@gmail.com> |
|---|---|
| First post | 2015-11-15 00:00 +0100 |
| Last post | 2015-11-18 10:40 +0100 |
| Articles | 8 — 5 participants |
Back to article view | Back to linux.debian.user
How to configure cron (and pam?) to allow mail from cron? Kynn Jones <kynnjo@gmail.com> - 2015-11-15 00:00 +0100
Re: How to configure cron (and pam?) to allow mail from cron? Gene Heskett <gheskett@shentel.net> - 2015-11-15 02:40 +0100
Re: How to configure cron (and pam?) to allow mail from cron? Kynn Jones <kynnjo@gmail.com> - 2015-11-15 03:30 +0100
Re: How to configure cron (and pam?) to allow mail from cron? Gene Heskett <gheskett@shentel.net> - 2015-11-15 04:10 +0100
Re: How to configure cron (and pam?) to allow mail from cron? David Wright <deblis@lionunicorn.co.uk> - 2015-11-17 16:10 +0100
Re: How to configure cron (and pam?) to allow mail from cron? Chris Bannister <cbannister@slingshot.co.nz> - 2015-11-17 19:10 +0100
Re: How to configure cron (and pam?) to allow mail from cron? <tomas@tuxteam.de> - 2015-11-17 19:20 +0100
Re: How to configure cron (and pam?) to allow mail from cron? Chris Bannister <cbannister@slingshot.co.nz> - 2015-11-18 10:40 +0100
| From | Kynn Jones <kynnjo@gmail.com> |
|---|---|
| Date | 2015-11-15 00:00 +0100 |
| Subject | How to configure cron (and pam?) to allow mail from cron? |
| Message-ID | <quRXA-1zA-13@gated-at.bofh.it> |
I'm trying to set up a `cron` job that will send me mail for some outputs.
In my `crontab` I have the `MAILTO` variable set to my email address,
as well as the directives
* * * * * /bin/date >> /tmp/debug_cron
* * * * * /bin/date >&2
as a test (i.e. a proxy for the command I eventually want to run), but
I'm getting no mail from `cron`. (I do get outptu in the
`/tmp/debug_cron` file.)
My `/var/log/auth.log` file shows many pairs of lines of the form:
Nov 14 17:25:01 myhost CRON[29571]: pam_unix(cron:session): session
opened for user myusername by (uid=0)
Nov 14 17:25:01 myhost CRON[29571]: pam_unix(cron:session): session
closed for user myusername
A new pair of such lines gets added every minute, which coincides with
the timing of my crontab commands. Therefore, it may be that
`pam_unix` is blocking `cron`'s attempt to send me mail? I don't know
how to pursue this possibility further. (I have never done any
PAM-related configuration in my life, so whatever configuration I have
is either what "came out of the box" when I installed Debian, or was
carried out by some program without my intervention.)
(BTW, aside from what I've described above, nothing else in the logs
appears relevant to this question, even remotely so.)
How can I troubleshoot this problem further?
Thanks in advance for any advice!
kj
PS: FWIW, my `/etc/pam.conf` file contains only comments and
whitespace, and here are the contents (excluding comments and
whitespace) of other `pam` relevant config files:
# /etc/pam.d/cron
@include common-auth
session required pam_loginuid.so
session required pam_env.so
session required pam_env.so envfile=/etc/default/locale
@include common-account
@include common-session-noninteractive
session required pam_limits.so
# /etc/pam.d/common-auth
auth [success=1 default=ignore] pam_unix.so nullok_secure
auth requisite pam_deny.so
auth required pam_permit.so
auth optional pam_cap.so
# /etc/pam.d/common-account
account [success=1 new_authtok_reqd=done default=ignore] pam_unix.so
account requisite pam_deny.so
account required pam_permit.so
# /etc/pam.d/common-session-noninteractive
session [default=1] pam_permit.so
session requisite pam_deny.so
session required pam_permit.so
session required pam_unix.so
[toc] | [next] | [standalone]
| From | Gene Heskett <gheskett@shentel.net> |
|---|---|
| Date | 2015-11-15 02:40 +0100 |
| Message-ID | <quUsp-3gM-1@gated-at.bofh.it> |
| In reply to | #160570 |
On Saturday 14 November 2015 17:58:59 Kynn Jones wrote: > I'm trying to set up a `cron` job that will send me mail for some > outputs. > > In my `crontab` I have the `MAILTO` variable set to my email address, > as well as the directives > > * * * * * /bin/date >> /tmp/debug_cron > * * * * * /bin/date >&2 On the machine, MAILTO: is not normally to your email address, but usually is username@localhost. > as a test (i.e. a proxy for the command I eventually want to run), but > I'm getting no mail from `cron`. (I do get outptu in the > `/tmp/debug_cron` file.) > > My `/var/log/auth.log` file shows many pairs of lines of the form: > > Nov 14 17:25:01 myhost CRON[29571]: pam_unix(cron:session): session > opened for user myusername by (uid=0) > Nov 14 17:25:01 myhost CRON[29571]: pam_unix(cron:session): session > closed for user myusername > > A new pair of such lines gets added every minute, which coincides with > the timing of my crontab commands. Therefore, it may be that > `pam_unix` is blocking `cron`'s attempt to send me mail? I don't know > how to pursue this possibility further. (I have never done any > PAM-related configuration in my life, so whatever configuration I have > is either what "came out of the box" when I installed Debian, or was > carried out by some program without my intervention.) > > (BTW, aside from what I've described above, nothing else in the logs > appears relevant to this question, even remotely so.) > > How can I troubleshoot this problem further? > > Thanks in advance for any advice! > > kj > > PS: FWIW, my `/etc/pam.conf` file contains only comments and > whitespace, and here are the contents (excluding comments and > whitespace) of other `pam` relevant config files: > > # /etc/pam.d/cron > @include common-auth > session required pam_loginuid.so > session required pam_env.so > session required pam_env.so envfile=/etc/default/locale > @include common-account > @include common-session-noninteractive > session required pam_limits.so > > # /etc/pam.d/common-auth > auth [success=1 default=ignore] pam_unix.so nullok_secure > auth requisite pam_deny.so > auth required pam_permit.so > auth optional pam_cap.so > > # /etc/pam.d/common-account > account [success=1 new_authtok_reqd=done default=ignore] > pam_unix.so account requisite pam_deny.so > account required pam_permit.so > > # /etc/pam.d/common-session-noninteractive > session [default=1] pam_permit.so > session requisite pam_deny.so > session required pam_permit.so > session required pam_unix.so Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene>
[toc] | [prev] | [next] | [standalone]
| From | Kynn Jones <kynnjo@gmail.com> |
|---|---|
| Date | 2015-11-15 03:30 +0100 |
| Message-ID | <quVeN-3MW-15@gated-at.bofh.it> |
| In reply to | #160573 |
On Sat, Nov 14, 2015 at 8:36 PM, Gene Heskett <gheskett@shentel.net> wrote: > On Saturday 14 November 2015 17:58:59 Kynn Jones wrote: > >> I'm trying to set up a `cron` job that will send me mail for some >> outputs. >> >> In my `crontab` I have the `MAILTO` variable set to my email address, >> as well as the directives >> >> * * * * * /bin/date >> /tmp/debug_cron >> * * * * * /bin/date >&2 > On the machine, MAILTO: is not normally to your email address, but > usually is username@localhost. Oh, I see. That makes cron's mail feature significantly less useful/convenient than I thought. Thanks! kj
[toc] | [prev] | [next] | [standalone]
| From | Gene Heskett <gheskett@shentel.net> |
|---|---|
| Date | 2015-11-15 04:10 +0100 |
| Message-ID | <quVRv-4eT-3@gated-at.bofh.it> |
| In reply to | #160574 |
On Saturday 14 November 2015 21:25:47 Kynn Jones wrote: > On Sat, Nov 14, 2015 at 8:36 PM, Gene Heskett <gheskett@shentel.net> wrote: > > On Saturday 14 November 2015 17:58:59 Kynn Jones wrote: > >> I'm trying to set up a `cron` job that will send me mail for some > >> outputs. > >> > >> In my `crontab` I have the `MAILTO` variable set to my email > >> address, as well as the directives > >> > >> * * * * * /bin/date >> /tmp/debug_cron > >> * * * * * /bin/date >&2 > > > > On the machine, MAILTO: is not normally to your email address, but > > usually is username@localhost. > > Oh, I see. That makes cron's mail feature significantly less > useful/convenient than I thought. > > Thanks! > > kj Works just fine. I get all the mails from clamscan, amanda, and spamassassin's utilities that way. The idea is that when a background task is done, it sends you an email with the results. Cheers, Gene Heskett -- "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." -Ed Howdershelt (Author) Genes Web page <http://geneslinuxbox.net:6309/gene>
[toc] | [prev] | [next] | [standalone]
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Date | 2015-11-17 16:10 +0100 |
| Message-ID | <qvQ3o-6Fs-15@gated-at.bofh.it> |
| In reply to | #160574 |
On Sat 14 Nov 2015 at 21:25:47 (-0500), Kynn Jones wrote: > On Sat, Nov 14, 2015 at 8:36 PM, Gene Heskett <gheskett@shentel.net> wrote: > > On Saturday 14 November 2015 17:58:59 Kynn Jones wrote: > > > >> I'm trying to set up a `cron` job that will send me mail for some > >> outputs. > >> > >> In my `crontab` I have the `MAILTO` variable set to my email address, > >> as well as the directives > >> > >> * * * * * /bin/date >> /tmp/debug_cron > >> * * * * * /bin/date >&2 > > On the machine, MAILTO: is not normally to your email address, but > > usually is username@localhost. > > Oh, I see. That makes cron's mail feature significantly less > useful/convenient than I thought. Well, typically I wouldn't want any of my cron MAILTOs to point outside my LAN. In fact, I find it less confusing to keep hosts' cron missives on each host rather than centrally. But in any case, that doesn't stop you from doing the following: MAILTO=myself * * * * * date >> /tmp/dated-$(date +\%F-\%R) && mutt -s $(date +\%F-\%R) -a /tmp/dated-$(date +\%F-\%R) -- my-internet@email-address.example.org Here the filename is datestamped (I don't want progressively longer emails), and mutt sends the appropriate file as an attachment. The -- terminates -a which introduces a *list* of files. I've used %R to give me 60 seconds of precision. (If the time were to advance, this scheme would fail.) It would be tidier to use one datestamp everywhere by saving it at the start. Alternatively you could get cron to run a normal script and do everything in that. Just don't be caught naming your script "script.sh" :) Cheers, David.
[toc] | [prev] | [next] | [standalone]
| From | Chris Bannister <cbannister@slingshot.co.nz> |
|---|---|
| Date | 2015-11-17 19:10 +0100 |
| Message-ID | <qvSRB-8wu-29@gated-at.bofh.it> |
| In reply to | #160671 |
On Tue, Nov 17, 2015 at 09:05:03AM -0600, David Wright wrote: > Alternatively you could get cron to run a normal script and do > everything in that. Just don't be caught naming your script > "script.sh" :) Especially if it's written in Perl. :) -- "If you're not careful, the newspapers will have you hating the people who are being oppressed, and loving the people who are doing the oppressing." --- Malcolm X
[toc] | [prev] | [next] | [standalone]
| From | <tomas@tuxteam.de> |
|---|---|
| Date | 2015-11-17 19:20 +0100 |
| Message-ID | <qvT1f-89-15@gated-at.bofh.it> |
| In reply to | #160678 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wed, Nov 18, 2015 at 07:04:38AM +1300, Chris Bannister wrote: > On Tue, Nov 17, 2015 at 09:05:03AM -0600, David Wright wrote: > > Alternatively you could get cron to run a normal script and do > > everything in that. Just don't be caught naming your script > > "script.sh" :) > > Especially if it's written in Perl. :) Shhht! The File Police is watching ;-) - -- t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAlZLZV4ACgkQBcgs9XrR2kZE7wCeN4i/IYnqGSc9Scde3PT3Vx+8 d9QAn1x6gcrh2lc+n4yJRhYj+Sl0PgoD =IHEC -----END PGP SIGNATURE-----
[toc] | [prev] | [next] | [standalone]
| From | Chris Bannister <cbannister@slingshot.co.nz> |
|---|---|
| Date | 2015-11-18 10:40 +0100 |
| Message-ID | <qw7nB-13M-31@gated-at.bofh.it> |
| In reply to | #160681 |
On Tue, Nov 17, 2015 at 06:35:26PM +0100, tomas@tuxteam.de wrote: > On Wed, Nov 18, 2015 at 07:04:38AM +1300, Chris Bannister wrote: > > On Tue, Nov 17, 2015 at 09:05:03AM -0600, David Wright wrote: > > > Alternatively you could get cron to run a normal script and do > > > everything in that. Just don't be caught naming your script > > > "script.sh" :) > > > > Especially if it's written in Perl. :) > > Shhht! The File Police is watching ;-) Please! No swearing. :) "Pssst!" "I haven't touched a drop!" -- "If you're not careful, the newspapers will have you hating the people who are being oppressed, and loving the people who are doing the oppressing." --- Malcolm X
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web