From owner-freebsd-questions@FreeBSD.ORG Tue Oct 7 12:36:14 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D88C7106569B for ; Tue, 7 Oct 2008 12:36:14 +0000 (UTC) (envelope-from dave.list@pixelhammer.com) Received: from smtp1.tls.net (smtp1.tls.net [65.124.104.104]) by mx1.freebsd.org (Postfix) with ESMTP id 71AC48FC21 for ; Tue, 7 Oct 2008 12:36:14 +0000 (UTC) (envelope-from dave.list@pixelhammer.com) Received: (qmail 96798 invoked from network); 7 Oct 2008 12:36:13 -0000 Received: by simscan 1.2.3 ppid: 96780, pid: 96795, t: 0.1449s scanners: attach: 1.2.3 spam: 3.2.1 X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on smtp1.tls.net X-Spam-Level: X-Spam-Status: No, score=0.2 required=10.0 tests=ALL_TRUSTED,TVD_RCVD_IP autolearn=disabled version=3.2.1 Received: from 64-184-11-201.bb.hrtc.net (HELO ?192.168.1.46?) (ldg@tls.net@64.184.11.201) by ssl-smtp1.tls.net with ESMTPA; 7 Oct 2008 12:36:12 -0000 Message-ID: <48EB57B4.2030406@pixelhammer.com> Date: Tue, 07 Oct 2008 08:36:04 -0400 From: DAve User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <48E4E4B8.90202@pixelhammer.com> <200810051909.01619.fbsd.questions@rachie.is-a-geek.net> In-Reply-To: <200810051909.01619.fbsd.questions@rachie.is-a-geek.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Running cron jobs as nobody X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Oct 2008 12:36:14 -0000 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!