*BSD News Article 43874


Return to BSD News archive

Newsgroups: comp.unix.bsd.freebsd.misc
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!news.hawaii.edu!ames!haven.umd.edu!news.umbc.edu!cs.umd.edu!zombie.ncsc.mil!news.mathworks.com!udel!gatech!howland.reston.ans.net!ix.netcom.com!netcom.com!kientzle
From: kientzle@netcom.com
Subject: Find bug
Message-ID: <kientzleD7rAq3.5q2@netcom.com>
Summary: -perm -or -perm broken
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
Date: Fri, 28 Apr 1995 17:46:50 GMT
Lines: 38
Sender: kientzle@netcom15.netcom.com

I've been tinkering with the daily and weekly scripts, and ran across
something curious.  The following command is currently (2.0R) used in
/etc/security to find all files which are either setuid or setgid.  It
doesn't work.  On my system, the following command only prints files
which are setgid but NOT setuid.  Swapping the two -perm arguments
results in files which are setuid but NOT setgid.  (You can check
/var/log/setuid.today and see if there are both setuid and setgid
files listed there.)  This is apparently a bug in find's handling of
the -perm argument.

        find $mount -xdev -perm -u+s -or -perm -g+s 

Has this been fixed?

                        - Tim Kientzle

P.S.  Since my FreeBSD machine is not on 24 hours a day, the normal
daily/weekly scripts weren't all that useful.  I instead broke
daily into a collection of scripts in /etc/daily.jobs, each of which
does a single task, and then replaced /etc/daily with a script
containing a variant of the following command:

find /etc/daily.jobs -type f -user root -mtime +1 \
         -exec {} ";" -exec touch {} ";" -exec sleep 300 ";"

This uses the file timestamp to determine which of the scripts
in daily.jobs are at least a day old, then runs the script and
updates the time stamp.  The sleep helps reduce apparent system load, and
I've introduced calls to /usr/bin/nice at strategic points in the
individual tasks (especially before calls to find) to help ease things
further.  This revised /etc/daily is called every other hour by cron,
with the result that daily tasks are run about once every 26 hours, assuming
the computer is actually on at the time.  The strategy of having one
script per task has also made it easy to shuffle tasks between daily and
weekly simply by moving the file between daily.jobs and weekly.jobs.
It also makes it very easy to add new daily or weekly tasks.

I thought others might find this idea useful...