Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Oct 2008 08:36:04 -0400
From:      DAve <dave.list@pixelhammer.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: Running cron jobs as nobody
Message-ID:  <48EB57B4.2030406@pixelhammer.com>
In-Reply-To: <200810051909.01619.fbsd.questions@rachie.is-a-geek.net>
References:  <48E4E4B8.90202@pixelhammer.com> <200810051909.01619.fbsd.questions@rachie.is-a-geek.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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!



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48EB57B4.2030406>