find and autofs

  • Follow


I have a few cron jobs which start jobs like 'find / ....' and
these jobs, in cooperation with autofs tries to mount all of the
hosts in my /etc/hosts file as //net/somehost.fdqn.blah

How can I constrain find to not try to search the network?  My
best guess is to constrain it by filesystem type.  I thought find
had a "stay local please" flag, but I can't find that in the
manual page, in the info pages, nor through the --help flag.

Alternatively, if I could constrain autofs from looking into
/etc/hosts and trying to mount hosts that I haven't told it to
mount, that would be great too.

Thanks...

-- 
PLEASE post a SUMMARY of the answer(s) to your question(s)!
Unless otherwise noted, the statements herein reflect my personal
opinions and not those of any organization with which I may be affiliated.
0
Reply Kevin 3/5/2010 7:48:31 PM

Kevin the Drummer wrote:

> How can I constrain find to not try to search the network?  My
> best guess is to constrain it by filesystem type.  I thought find
> had a "stay local please" flag.

The GNU version of find offers the -xdev flag which should do exactly that.

> Alternatively, if I could constrain autofs from looking into
> /etc/hosts and trying to mount hosts that I haven't told it to
> mount, that would be great too.

Hmmm, I don't understand what you mean. If autofs isn't supposed to
mount certain hosts, why do you include these hosts in /etc/auto.master
or /etc/auto.misc in first place?

So long,
	Thomas
0
Reply thor16 (320) 3/5/2010 7:56:03 PM


* Kevin the Drummer <nobody@cosgroves.us>:
> How can I constrain find to not try to search the network?  My
> best guess is to constrain it by filesystem type.  I thought find
> had a "stay local please" flag, but I can't find that in the
> manual page, in the info pages, nor through the --help flag.

find ... -xdev ...
0
Reply xyzzy1 (6) 3/5/2010 8:48:21 PM

On comp.os.linux.misc, Kevin the Drummer <nobody@cosgroves.us> wrote:
> I have a few cron jobs which start jobs like 'find / ....' and
> these jobs, in cooperation with autofs tries to mount all of the
> hosts in my /etc/hosts file as //net/somehost.fdqn.blah
>
> How can I constrain find to not try to search the network?  My
> best guess is to constrain it by filesystem type.  I thought find
> had a "stay local please" flag, but I can't find that in the
> manual page, in the info pages, nor through the --help flag.
>
> Alternatively, if I could constrain autofs from looking into
> /etc/hosts and trying to mount hosts that I haven't told it to
> mount, that would be great too.
>
> Thanks...

I think what you need to use is -prune to keep find from accessing
the mount points of the remote file systems.

But I'm not good enough with find to give you the details. I
suggest you post this question on comp.unix.shell.


> -- 
> PLEASE post a SUMMARY of the answer(s) to your question(s)!
> Unless otherwise noted, the statements herein reflect my personal
> opinions and not those of any organization with which I may be affiliated.

What a bunch of nonsense that is.


Sid

0
Reply Sidney 3/5/2010 9:39:46 PM

On Fri, 05 Mar 2010 22:39:46 +0100, Sidney Lambe wrote:

> On comp.os.linux.misc, Kevin the Drummer <nobody@cosgroves.us> wrote:
>> I have a few cron jobs which start jobs like 'find / ....' and these
>> jobs, in cooperation with autofs tries to mount all of the hosts in my
>> /etc/hosts file as //net/somehost.fdqn.blah
>>
>> How can I constrain find to not try to search the network?  My best
>> guess is to constrain it by filesystem type.  I thought find had a
>> "stay local please" flag, but I can't find that in the manual page, in
>> the info pages, nor through the --help flag.
>>
>> Alternatively, if I could constrain autofs from looking into /etc/hosts
>> and trying to mount hosts that I haven't told it to mount, that would
>> be great too.
>>
>> Thanks...
> 
> I think what you need to use is -prune to keep find from accessing the
> mount points of the remote file systems.

Yes or you could add them all to the updatedb.conf file and ensure that
updatedb sources it before running.

>> --
>> PLEASE post a SUMMARY of the answer(s) to your question(s)! Unless
>> otherwise noted, the statements herein reflect my personal opinions and
>> not those of any organization with which I may be affiliated.
> 
> What a bunch of nonsense that is.

Indeed so -- your boss can still fire you for expressing your opinions
even if you put a disclaimer that it is your own opinion.

<http://www.npr.ORG/templates/transcript/transcript.php?storyId=123024596>



And for a complete updatedb.conf to keep out the extranous stuff ...


#*****************************************************************************#
#|
#|  file : /etc/updatedb.conf
#|
#*---------------------------------------------------------------------------
*#
#
# Filesystem bind mounts are pruned from updatedb database.
#
#.............................................................................#
#
PRUNE_BIND_MOUNTS="yes"
#
#*---------------------------------------------------------------------------
*#
#
# Filesystems which are pruned from updatedb database.
#
#.............................................................................#
#
PRUNEFS="afs auto autofs binfmt_misc cifs devpts iso9660 msdos ncpfs NFS 
nfs pipefs proc rootfs selinuxfs sfs shm smbfs sockfs tmpfs udf usbdevfs"
#
#*---------------------------------------------------------------------------
*#
#
# Paths which are pruned from updatedb database.
#
#.............................................................................#
#
PRUNEPATHS="/auto /boot /dev /export /initrd /lost+found /media /mnt /
net /proc /sys /tmp /usr/tmp /var/mail /var/run /var/spool /var/tmp"
#
#*****************************************************************************#
0
Reply J 3/5/2010 9:58:38 PM

On comp.os.linux.misc, J G Miller <miller@yoyo.ORG> wrote:

> On Fri, 05 Mar 2010 22:39:46 +0100, Sidney Lambe wrote:
>
>> On comp.os.linux.misc, Kevin the Drummer <nobody@cosgroves.us>
>> wrote:
>>
>>> I have a few cron jobs which start jobs like 'find /
>>> ....' and these jobs, in cooperation with autofs tries
>>> to mount all of the hosts in my /etc/hosts file as
>>> //net/somehost.fdqn.blah
>>>
>>> How can I constrain find to not try to search the network? My
>>> best guess is to constrain it by filesystem type. I thought
>>> find had a "stay local please" flag, but I can't find that in
>>> the manual page, in the info pages, nor through the --help
>>> flag.
>>>
>>> Alternatively, if I could constrain autofs from looking into
>>> /etc/hosts and trying to mount hosts that I haven't told it
>>> to mount, that would be great too.
>>>
>>> Thanks...
>>
>> I think what you need to use is -prune to keep find from
>> accessing the mount points of the remote file systems.

Or maybe the top dirs of the remote filesystems.

This works for one such subdir, but I don't know the syntax
for a list of them.

find . -path './some-dir' -prune -o -print

>
> Yes or you could add them all to the updatedb.conf file and
> ensure that updatedb sources it before running.

>
>>> -- PLEASE post a SUMMARY of the answer(s) to your
>>> question(s)! Unless otherwise noted, the statements
>>> herein reflect my personal opinions and not those of any
>>> organization with which I may be affiliated.
>>
>> What a bunch of nonsense that is.
>
> Indeed so -- your boss can still fire you for expressing your
> opinions even if you put a disclaimer that it is your own
> opinion.
>
><http://www.npr.ORG/templates/transcript/transcript.php?storyId=
>123024596>
>
>
>


> And for a complete updatedb.conf to keep out the extranous stuff ...
>
>
> #*****************************************************************************#
> #|
> #|  file : /etc/updatedb.conf
> #|
> #*---------------------------------------------------------------------------
> *#
> #
> # Filesystem bind mounts are pruned from updatedb database.
> #
> #.............................................................................#
> #
> PRUNE_BIND_MOUNTS="yes"
> #
> #*---------------------------------------------------------------------------
> *#
> #
> # Filesystems which are pruned from updatedb database.
> #
> #.............................................................................#
> #
> PRUNEFS="afs auto autofs binfmt_misc cifs devpts iso9660 msdos ncpfs NFS 
> nfs pipefs proc rootfs selinuxfs sfs shm smbfs sockfs tmpfs udf usbdevfs"
> #
> #*---------------------------------------------------------------------------
> *#
> #
> # Paths which are pruned from updatedb database.
> #
> #.............................................................................#
> #
> PRUNEPATHS="/auto /boot /dev /export /initrd /lost+found /media /mnt /
> net /proc /sys /tmp /usr/tmp /var/mail /var/run /var/spool /var/tmp"
> #
> #*****************************************************************************#

That's an excellent solution.

Sid

0
Reply Sidney 3/5/2010 10:03:55 PM

Kevin the Drummer <nobody@cosgroves.us> writes:

> I have a few cron jobs which start jobs like 'find / ....' and
> these jobs, in cooperation with autofs tries to mount all of the
> hosts in my /etc/hosts file as //net/somehost.fdqn.blah
>
> How can I constrain find to not try to search the network?  My
> best guess is to constrain it by filesystem type.  I thought find
> had a "stay local please" flag, but I can't find that in the
> manual page, in the info pages, nor through the --help flag.

,----
|      -mount Don't descend directories on other filesystems.  An
|             alternate name for -xdev, for compatibility with some
|             other versions of find.
`----



   Florian
-- 
GUIs programmieren mit Python und Glade:
<http://www.florian-diesch.de/doc/python-und-glade/>
0
Reply diesch (335) 3/5/2010 10:36:50 PM

Sidney Lambe <sidneylambe@nospam.invalid> wrote:
>  On comp.os.linux.misc, Kevin the Drummer <nobody@cosgroves.us> wrote:
> > I have a few cron jobs which start jobs like 'find / ....' and
> > these jobs, in cooperation with autofs tries to mount all of the
> > hosts in my /etc/hosts file as //net/somehost.fdqn.blah
> >
> > How can I constrain find to not try to search the network?  My
> > best guess is to constrain it by filesystem type.  I thought find
> > had a "stay local please" flag, but I can't find that in the
> > manual page, in the info pages, nor through the --help flag.
> >
> > Alternatively, if I could constrain autofs from looking into
> > /etc/hosts and trying to mount hosts that I haven't told it to
> > mount, that would be great too.
> >
> > Thanks...
> 
>  I think what you need to use is -prune to keep find from accessing
>  the mount points of the remote file systems.
> 
>  But I'm not good enough with find to give you the details. I
>  suggest you post this question on comp.unix.shell.

Thanks.  I'll look further into -prune.

> > -- 
> > PLEASE post a SUMMARY of the answer(s) to your question(s)!
> > Unless otherwise noted, the statements herein reflect my personal
> > opinions and not those of any organization with which I may be affiliated.
> 
>  What a bunch of nonsense that is.

Would you prefer "I speak for me"?  Or, maybe nothing?  Or, maybe some
cute/annoying anecdote?

The part asking for folks to post a summary comes from when
I was a member of the Sun Managers email list.  Posting a
summary/solution was part of the rules of membership, and the
price for the free help.  That worked well for me back then.

Cheers....

-- 
PLEASE post a SUMMARY of the answer(s) to your question(s)!
Unless otherwise noted, the statements herein reflect my personal
opinions and not those of any organization with which I may be affiliated.
0
Reply Kevin 3/8/2010 4:49:45 PM

On comp.os.linux.misc, Kevin the Drummer <nobody@cosgroves.us>
wrote:

> Sidney Lambe <sidneylambe@nospam.invalid> wrote:
>
>>  On comp.os.linux.misc, Kevin the Drummer
>>  <nobody@cosgroves.us> wrote:
>>
>> > I have a few cron jobs which start jobs like 'find /
>> > ....' and these jobs, in cooperation with autofs tries
>> > to mount all of the hosts in my /etc/hosts file as
>> > //net/somehost.fdqn.blah
>> >
>> > How can I constrain find to not try to search the network?
>> > My best guess is to constrain it by filesystem type. I
>> > thought find had a "stay local please" flag, but I can't
>> > find that in the manual page, in the info pages, nor through
>> > the --help flag.
>> >
>> > Alternatively, if I could constrain autofs from looking into
>> > /etc/hosts and trying to mount hosts that I haven't told it
>> > to mount, that would be great too.
>> >
>> > Thanks...
>>
>>  I think what you need to use is -prune to keep find from
>>  accessing the mount points of the remote file systems.
>>
>>  But I'm not good enough with find to give you the details. I
>>  suggest you post this question on comp.unix.shell.
>
> Thanks. I'll look further into -prune.

Hi Kevin. I was looking through some of my scripts, and the
solution to problems like yours with find that I have employed
many times is to list just the directories I want find to
descend into:

find /dir1  /dir2  /dir3/subdir/subdir/ /dir4/subdir/ ....

Then find ignores everything else.


[delete]


Sid



0
Reply Sidney 3/8/2010 5:12:29 PM

In <slrnhpaal5.d8a.nobody@joseph.cosgroves.us> Kevin the Drummer:

[Snip...]

> Cheers....

FWIW, your sig is fine. Just some loons read *EVERYTHING* as politics.

-- 
Regards, Weird (Harold Stevens) * IMPORTANT EMAIL INFO FOLLOWS *
Pardon any bogus email addresses (wookie) in place for spambots.
Really, it's (wyrd) at airmail, dotted with net. DO NOT SPAM IT.
I toss GoogleGroup (http://twovoyagers.com/improve-usenet.org/).
0
Reply Harold 3/8/2010 5:16:24 PM

J G Miller <miller@yoyo.ORG> wrote:
>  On Fri, 05 Mar 2010 22:39:46 +0100, Sidney Lambe wrote:
> > On comp.os.linux.misc, Kevin the Drummer <nobody@cosgroves.us> wrote:
> >> I have a few cron jobs which start jobs like 'find / ....' and these
> >> jobs, in cooperation with autofs tries to mount all of the hosts in my
> >> /etc/hosts file as //net/somehost.fdqn.blah
> >>
> >> How can I constrain find to not try to search the network?  My best
> >> guess is to constrain it by filesystem type.  I thought find had a
> >> "stay local please" flag, but I can't find that in the manual page, in
> >> the info pages, nor through the --help flag.
> >>
> >> Alternatively, if I could constrain autofs from looking into /etc/hosts
> >> and trying to mount hosts that I haven't told it to mount, that would
> >> be great too.
> > 
> > I think what you need to use is -prune to keep find from accessing the
> > mount points of the remote file systems.
> 
>  Yes or you could add them all to the updatedb.conf file and ensure that
>  updatedb sources it before running.

As it turns out, my updatedb.conf file already specifies
/net as a path to prune.  Also, my log files tell me that
/etc/cron.daily/msec and /home/local/etc/cron.daily/check-rootkit
are the processes which are trying to search the net.

For msec I added /net to MOUNTPOINT_FILTER='^\/mnt|^\/media|^\/net' in
/usr/share/msec/functions.sh

It's more difficult to pinpoint the source of the presumed
offending find in check-rootkit as running /usr/sbin/chkrootkit
in debug mode doesn't produce the same error as when it's run
from cron.  I added the debug flag to the chkrootkit command line
in the cron script, then ran that cron script manually.  Still no
errors.  Say what?  Still hunting.

> >> --
> >> PLEASE post a SUMMARY of the answer(s) to your question(s)! Unless
> >> otherwise noted, the statements herein reflect my personal opinions and
> >> not those of any organization with which I may be affiliated.
> > 
> > What a bunch of nonsense that is.
> 
>  Indeed so -- your boss can still fire you for expressing your opinions
>  even if you put a disclaimer that it is your own opinion.
> 
> <http://www.npr.ORG/templates/transcript/transcript.php?storyId=123024596>

Yes, my exwife had a clause in her contract as a public school
teacher that said she could be fired if she embarassed the school
district.

The updatedb.conf stuff below looks great.  If that was the
source of my trouble, then I'd be even closer to a solution.

Thanks!

>  And for a complete updatedb.conf to keep out the extranous stuff ...
> 
> 
>  #*****************************************************************************#
>  #|
>  #|  file : /etc/updatedb.conf
>  #|
>  #*---------------------------------------------------------------------------
>  *#
>  #
>  # Filesystem bind mounts are pruned from updatedb database.
>  #
>  #.............................................................................#
>  #
>  PRUNE_BIND_MOUNTS="yes"
>  #
>  #*---------------------------------------------------------------------------
>  *#
>  #
>  # Filesystems which are pruned from updatedb database.
>  #
>  #.............................................................................#
>  #
>  PRUNEFS="afs auto autofs binfmt_misc cifs devpts iso9660 msdos ncpfs NFS 
>  nfs pipefs proc rootfs selinuxfs sfs shm smbfs sockfs tmpfs udf usbdevfs"
>  #
>  #*---------------------------------------------------------------------------
>  *#
>  #
>  # Paths which are pruned from updatedb database.
>  #
>  #.............................................................................#
>  #
>  PRUNEPATHS="/auto /boot /dev /export /initrd /lost+found /media /mnt /
>  net /proc /sys /tmp /usr/tmp /var/mail /var/run /var/spool /var/tmp"
>  #
>  #*****************************************************************************#


-- 
PLEASE post a SUMMARY of the answer(s) to your question(s)!
Unless otherwise noted, the statements herein reflect my personal
opinions and not those of any organization with which I may be affiliated.
0
Reply Kevin 3/8/2010 5:28:34 PM

On 03/05/10 14:56, Thomas Richter wrote:
> Kevin the Drummer wrote:
>
>> How can I constrain find to not try to search the network? My
>> best guess is to constrain it by filesystem type. I thought find
>> had a "stay local please" flag.
>
> The GNU version of find offers the -xdev flag which should do exactly that.

-xdev will prevent crossing any filesystem. So if you have 2 local
partitions (disks) mounted it won't get to the 2nd. Use -prune
with -fstype or the path to restrict.

find / -path /net -prune -o -print

find / -fstype nfs -prune -o -print
0
Reply joe248 (217) 3/8/2010 6:08:41 PM

Joe Beanfish <joe@nospam.duh> wrote:
>  On 03/05/10 14:56, Thomas Richter wrote:
> > Kevin the Drummer wrote:
> >
> >> How can I constrain find to not try to search the network? My
> >> best guess is to constrain it by filesystem type. I thought find
> >> had a "stay local please" flag.
> >
> > The GNU version of find offers the -xdev flag which should do exactly that.
> 
>  -xdev will prevent crossing any filesystem. So if you have 2 local
>  partitions (disks) mounted it won't get to the 2nd. Use -prune
>  with -fstype or the path to restrict.
> 
>  find / -path /net -prune -o -print
> 
>  find / -fstype nfs -prune -o -print

That last one, with the fstype, looks just great.  Thanks!  Now
I'm trying to find where there are find commands in my cron jobs.
I think the last bunch of them are in my rootkit checker.

Thanks again....

-- 
PLEASE post a SUMMARY of the answer(s) to your question(s)!
Unless otherwise noted, the statements herein reflect my personal
opinions and not those of any organization with which I may be affiliated.
0
Reply nobody4488 (76) 3/9/2010 5:01:58 PM

12 Replies
104 Views

(page loaded in 0.147 seconds)

Similiar Articles:













7/26/2012 3:30:11 PM


Reply: