Running cron jobs as nobody
derek at computinginnovations.com
Fri Oct 3 11:14:42 UTC 2008
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?
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.
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the freebsd-questions