Friday, September 16, 2005

find and no NFS

Subject: Summary: find and no NFS

The original post was about locate world-writeable file and setuid

I want to limited the find to local filesystems only. I don't want
multiple NFS clients run the find on the same NFS export. I got some
permission errors and "Stale NFS file handle" errors with "-local".

There were many many replies. Sorry, I can't list everyone replied. The
suggestions are:

1. It is your fault, RTFM again.
Manpage said -local *WILL* descend the hierarchy of non-local

2. Check out "-prune"
Always yields true. Does not examine any directories or files in
the directory structure below the pattern just matched.

3. use -xdev
Same as -mount primary

4. try -mount

5. Manpage! There's an example in the manpage
Example 9: Printing local files without descending non-local
%find . ! -local -prune -o -print

1. The main point is "-local" still descend NFS mounted directories.
That's why I got some errors.
2. To get the job done--->
Since I want find to drill down from / on many systems with probably
different filesystem setup. I can't use "-mount" for each filesystem.

Darren Dunham pointed out that
find / \( -fstype ufs -o -fstype vxfs \) -type f -perm -6000 -print
>All that happens there is that the result on remote files is false. It
>doesn't stop the recursion. You need -prune for that. That's what
>Example 9 in the man page does.

Dan Stromberg suggested
> find . -fstype nfs -prune -o -print

Nope, I don't have an exact answer yet. I was out yesterday. I played
with this a bit this morning. The followings seems to good so far

find / -fstype nfs -prune -o -perm -2 -print
find / \! -local -prune -o -perm -2 -print

Thanks a lot ... and I'll remember to boot up my brain before reading the
man page.


Post a Comment

<< Home