[NTLUG:Discuss] testing and results Re: crontab issue

Robert Citek robert.citek at gmail.com
Thu Mar 15 13:17:06 CDT 2007


Fred James wrote:
> Robert Citek
> Distro: Mandrake/Mandriva 9.x, 10.x, and 2006
> Problem: as root with root crontab, it seemed to be working (more 
> testing maybe?), but as another user with their crontab there are still 
> some issues.

Here's a crontab variation for a non-root user (this time run on a FC4
box -- notice the "-c"):

SHELL=/bin/bash
* * * * * date > /tmp/date.cron.user.1 2> /tmp/date.cron.user.1.err
* * * * * date +%Y > /tmp/date.cron.user.2 2> /tmp/date.cron.user.2.err
* * * * * date +\%Y > /tmp/date.cron.user.3 2> /tmp/date.cron.user.3.err
* * * * * su - foo -c date +\%Y > /tmp/date.cron.user.4 2>
/tmp/date.cron.user.4.err
* * * * * su - foo -c "date +\%Y > /tmp/date.cron.user.5" 2>
/tmp/date.cron.user.5.err

Here are the contents from the error files:

$ tail -n +1 /tmp/date.cron.user.*.err
==> /tmp/date.cron.user.1.err <==

==> /tmp/date.cron.user.3.err <==

==> /tmp/date.cron.user.4.err <==
standard in must be a tty

==> /tmp/date.cron.user.5.err <==
standard in must be a tty

Conclusion: su requires a password from a non-root user, which requires
a tty.

Regards,
- Robert




More information about the Discuss mailing list