Operating System - HP-UX
1829161 Members
10299 Online
109986 Solutions
New Discussion

Re: find SUID executable file excluding nfs file system...

 
Jonathan Caplette_1
Super Advisor

find SUID executable file excluding nfs file system...

Hi guys,

I'm trying to find the SUID executable files on the entire system... but it still goes throught the nfs filesystem and give me this "find cannot open..." I want to avoid this in my logs... SO I tried this:

find / -type f -perm -04000 ! -path "/dirnfs1/*" ! -path "/dirnfs2/*"

I also tried replacing -path by -name... Got the same thing...

The file are printed... but I also have a lot something like 30000 line of "find: cannot open... /dirnfs1... "

Anyone have an idea???

Jonathan
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: find SUID executable file excluding nfs file system...

Hi Jonathan:

You can skip NFS filesystems by adding '! -fstype nfs' to your 'find':

# find / ! -fstype nfs -type f -perm -04000

See the manpages for 'find' for more information.

Regards!

...JRF...
Jonathan Caplette_1
Super Advisor

Re: find SUID executable file excluding nfs file system...

I tried to add ! -fstype nfs in my find, in fact I did what JRF suggested me... and I still receving this kind of error:

find: cannot open /uc_nfs_webspool_RO/fsprd/psreports/021609331179FA2DF75BD8A8E4AA292478F572CE7BDC7
0EE4ECB2756BF5C36C06930362A9FD163B0F179900371A3BE

This fs is automount...

Any idea why?
Tiziano Contorno _
Valued Contributor

Re: find SUID executable file excluding nfs file system...

Get all the mount points with a bdf and launch a find for each filesystem using "-xdev" option.

It may be done with a script that check also that the fs is not remotley mounted (ie first field does not contain a ":").

Regards.
Doug O'Leary
Honored Contributor

Re: find SUID executable file excluding nfs file system...


find / ! -local -prune -o -type f -perm -4000 -print

should do what you're looking for.

HTH;

Doug

------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
john korterman
Honored Contributor

Re: find SUID executable file excluding nfs file system...

Hi,

your find command probably looks into a directory which holds references to files that for some reason are not present.
If you cannot correct the error you can at least suppress the error messages by redirecting std. err. Try appending
2>/dev/null
to mr. Ferguson's suggestion.

regards,
John K.
it would be nice if you always got a second chance