[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#2996: "su" and userid confusion in updatedb



Package: findutils
Version: 4.1-10

I wanted to let updatedb search a networked drive, so I changed the
default /etc/cron.daily/find script to:

su nobody -c "cd / && updatedb --localpaths='' --netpaths=/pub/"

Unfortunately the script does a "su" to the "netuser" internally which
is daemon, and ofcourse this wants a password..

I've patched updatedb. Perhaps this should go back in the upstream version.

--- updatedb.org	Tue May 14 23:25:40 1996
+++ updatedb	Tue May 14 23:27:04 1996
@@ -99,8 +99,12 @@
 fi

 if test -n "$NETPATHS"; then
-  su $NETUSER -c \
-  "$find $NETPATHS \\( -type d -regex \"$PRUNEREGEX\" -prune \\) -o -print"
+  if [ "`whoami`" = root ]; then
+    su $NETUSER -c \
+    "$find $NETPATHS \\( -type d -regex \"$PRUNEREGEX\" -prune \\) -o -print"
+  else
+    $find $NETPATHS \( -type d -regex "$PRUNEREGEX" -prune \) -o -print
+  fi
 fi
 } | sort -f | $frcode > $LOCATE_DB.n

Mike.
--
  Miquel van    | Cistron Internet Services   --    Alphen aan den Rijn.
  Smoorenburg,  | mailto:info@cistron.nl          http://www.cistron.nl/
miquels@het.net | Tel: +31-172-419445 (Voice) 430979 (Fax) 442580 (Data)


Reply to: