Re: Running cron jobs as nobody
Mel wrote: On Thursday 02 October 2008 17:11:52 DAve wrote: Good morning all, We have a cronjob we need to run as nobody from /etc/crontab and it seems to be not working. The job runs, but not as user nobody. I noticed two things, 1) the job to update the locate DB runs as nobody, because the script uses su to become nobody. echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody || rc=3 ^^^ -fm: Bypass .cshrc and only change user, use root env. Is setting the user to nobody in /etc/crontab not possible? pw showuser operator pw showuser nobody Spot the difference (hint: /nonexistent) That was my first thought as well. After reading some of the responses I still thought it odd that cron would not run the script as "nobody". So I setup two scripts to dump the env vars into a file, one script runs from /etc/crontab and one from nobody's crontab. Both are functioning perfectly. I have told the developer to re investigate his script and his directory perms. I looks like a case of PEBKAC to me. Thanks for the responses. DAve -- Don't tell me I'm driving the cart! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Running cron jobs as nobody
On Thursday 02 October 2008 17:11:52 DAve wrote: > Good morning all, > > We have a cronjob we need to run as nobody from /etc/crontab and it > seems to be not working. The job runs, but not as user nobody. > > I noticed two things, > > 1) the job to update the locate DB runs as nobody, because the script > uses su to become nobody. > echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody || rc=3 ^^^ -fm: Bypass .cshrc and only change user, use root env. > Is setting the user to nobody in /etc/crontab not possible? pw showuser operator pw showuser nobody Spot the difference (hint: /nonexistent) -- Mel Problem with today's modular software: they start with the modules and never get to the software part. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Running cron jobs as nobody
At 10:11 AM 10/2/2008, DAve wrote: Good morning all, We have a cronjob we need to run as nobody from /etc/crontab and it seems to be not working. The job runs, but not as user nobody. I noticed two things, 1) the job to update the locate DB runs as nobody, because the script uses su to become nobody. echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody || rc=3 2) nobody, as expected, has no shell or home dir in /etc/password. I searched around for an answer but didn't see anything concerning this other than a patch to cron to check if setuid fails. Is setting the user to nobody in /etc/crontab not possible? Thanks, DAve I've done this two different ways: One is to use sudo and have your script su - to nobody. You will need to test your script first before trying it through cron. Create a cronjob for nobody using: crontab -e -u nobody Hope this helps. -Derek -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Running cron jobs as nobody
Bill Campbell wrote: You can use ``su -c '/path/to/command' username'' to run scripts as users other than root. Another way is to use ``crontab -u username''. man crontab for details. Bill I am being told the developer tried a user crontab without success. I've not suggested they try su yet though I dropped hints. Still seems odd that setting the user to nobody in /etc/crontab did not work. Dave -- Don't tell me I'm driving the cart! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Running cron jobs as nobody
You can use ``su -c '/path/to/command' username'' to run scripts as users other than root. Another way is to use ``crontab -u username''. man crontab for details. Bill -- INTERNET: [EMAIL PROTECTED] Bill Campbell; Celestial Software LLC URL: http://www.celestial.com/ PO Box 820; 6641 E. Mercer Way Voice: (206) 236-1676 Mercer Island, WA 98040-0820 Fax:(206) 232-9186 Of all the contrivances devised for cheating the laboring classes of mankind, none has been more effective than that which deludes him with paper money. -- -Daniel Webster ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Running cron jobs as nobody
Good morning all, We have a cronjob we need to run as nobody from /etc/crontab and it seems to be not working. The job runs, but not as user nobody. I noticed two things, 1) the job to update the locate DB runs as nobody, because the script uses su to become nobody. echo /usr/libexec/locate.updatedb | nice -5 su -fm nobody || rc=3 2) nobody, as expected, has no shell or home dir in /etc/password. I searched around for an answer but didn't see anything concerning this other than a patch to cron to check if setuid fails. Is setting the user to nobody in /etc/crontab not possible? Thanks, DAve -- Don't tell me I'm driving the cart! ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"