Date: Fri, 03 Oct 2008 06:14:32 -0500 From: Derek Ragona <derek@computinginnovations.com> To: DAve <dave.list@pixelhammer.com>, "'User Questions'" <freebsd-questions@freebsd.org> Subject: Re: Running cron jobs as nobody Message-ID: <6.0.0.22.2.20081003061201.02713660@mail.computinginnovations.com> In-Reply-To: <48E4E4B8.90202@pixelhammer.com> References: <48E4E4B8.90202@pixelhammer.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6.0.0.22.2.20081003061201.02713660>