From owner-freebsd-questions@FreeBSD.ORG Fri Oct 3 11:14:42 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 6F3FA1065678 for ; Fri, 3 Oct 2008 11:14:42 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from betty.computinginnovations.com (mail.computinginnovations.com [64.81.227.250]) by mx1.freebsd.org (Postfix) with ESMTP id 1D2388FC12 for ; Fri, 3 Oct 2008 11:14:41 +0000 (UTC) (envelope-from derek@computinginnovations.com) Received: from p28.computinginnovations.com (dhcp-10-20-30-100.computinginnovations.com [10.20.30.100]) (authenticated bits=0) by betty.computinginnovations.com (8.14.2/8.14.2) with ESMTP id m93BEcWb017735; Fri, 3 Oct 2008 06:14:39 -0500 (CDT) (envelope-from derek@computinginnovations.com) Message-Id: <6.0.0.22.2.20081003061201.02713660@mail.computinginnovations.com> X-Sender: derek@mail.computinginnovations.com X-Mailer: QUALCOMM Windows Eudora Version 6.0.0.22 Date: Fri, 03 Oct 2008 06:14:32 -0500 To: DAve , "'User Questions'" From: Derek Ragona In-Reply-To: <48E4E4B8.90202@pixelhammer.com> References: <48E4E4B8.90202@pixelhammer.com> Mime-Version: 1.0 X-Antivirus: avast! (VPS 081002-0, 10/02/2008), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: ClamAV 0.93.3/8372/Thu Oct 2 10:21:47 2008 on betty.computinginnovations.com X-Virus-Status: Clean X-ComputingInnovations-MailScanner-Information: Please contact the ISP for more information X-MailScanner-ID: m93BEcWb017735 X-ComputingInnovations-MailScanner: Found to be clean X-ComputingInnovations-MailScanner-From: derek@computinginnovations.com X-Spam-Status: No Content-Type: text/plain; charset="us-ascii"; format=flowed X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: 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: Fri, 03 Oct 2008 11:14:42 -0000 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.