"updatedb" cron job: test if called by root
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
findutils (Ubuntu) |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
Binary package hint: findutils
If you call findutils' /etc/cron.
If you remove "2>/dev/null" from the call of updatedb, you'll see this:
$ LANG=C /etc/cron.
rm: cannot remove `/var/cache/
su: must be run from a terminal
/usr/bin/updatedb: 310: cannot create /var/cache/
su: must be run from a terminal
Password:
I'd add a check for user==root at the top of the script (debian/
# Only allow root to start (preventing "su" prompt, where the label text has been suppressed)
if [ "$(id -u)" != "0" ]
then
echo "You must be root."
exit 1
fi
Normally, things in /etc/cron* shouldn't be run by regular users. I have marked this as a "wishlist" item. If you can prepare a patch for it, perhaps we can add it for Hardy? Thanks!