Running cron jobs as nobody

DAve dave.list at pixelhammer.com
Tue Oct 7 12:36:14 UTC 2008


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!


More information about the freebsd-questions mailing list