Operating System - HP-UX
1837770 Members
4603 Online
110119 Solutions
New Discussion

Re: Need find command to look user owenr "web" "webadm" files from /

 
SOLVED
Go to solution
Sammy_2
Super Advisor

Need find command to look user owenr "web" "webadm" files from /

Need find command to find files owned by "web" and "webadm" from / on down. I am root but want to ignore nfs moutned f/s. I am getting perm denied on those. Just local file system.

Need owner name and full path file name only.
good judgement comes from experience and experience comes from bad judgement.
7 REPLIES 7
Patrick Wallek
Honored Contributor
Solution

Re: Need find command to look user owenr "web" "webadm" files from /


# find / -type f \( -user web -o -user webadm \) ! -fstype nfs

Try the above. That should come close to what you need.
Sammy_2
Super Advisor

Re: Need find command to look user owenr "web" "webadm" files from /

Thanks . That was a step in the right direction.

But I tried but for some reason, I still get the automouted file system (starting with /net/xxx) ? is there any way to ignore those )

# find / -type f \( -user webadmin -o -user afemgr \) ! -fstype nfs
cannot open /proc/18122: No such file or directory
/proc/2347/fd/9
/proc/2347/fd/13
/proc/2347/object/vxfs.273.104015.2352
/proc/2347/object/vxfs.273.104015.2350
/proc/2347/object/vxfs.273.104015.2364
find: cannot read dir /net/houpnapp2/vol/vol0/etc/crash: Permission denied
find: cannot read dir /net/houpnapp2/vol/vol0/etc/.zapi: Permission denied
good judgement comes from experience and experience comes from bad judgement.
Patrick Wallek
Honored Contributor

Re: Need find command to look user owenr "web" "webadm" files from /

OK, that output tells me 2 things.

1) You are not on HP-UX. This appears to be Linux. Please remember that you posted this in HP-UX so people will assume that you are running HP-UX unless stated otherwise.

2) The find command *MAY* very well behave slightly differently on Linux. Your best bet would be to have a read through 'man find' and see what you can come up with.

TwoProc
Honored Contributor

Re: Need find command to look user owenr "web" "webadm" files from /

The following isn't as clean as Patrick's posting - but it might work for you.

You can search a single file system (that is, in most cases, a single mount point) by just specifying "-xdev" in your find command.

Then, just do your search for "web" and "webadm" in each file system separately:
(the following should work just as well on Linux as HPUX - it assumes your nfs mount points would not be mounting from anything called "dev" - which is unlikely, but may not work in your case, so just check for that):

for i in `df -k | grep \/dev\/ | cut -f1 -d ""`
do
echo searching file system $i
find $i -xdev -type f \( -user web -o -user webadm \)
done
We are the people our parents warned us about --Jimmy Buffett
TwoProc
Honored Contributor

Re: Need find command to look user owenr "web" "webadm" files from /

Oh, I just noticed: you don't need the "-k" switch for the "df" command in the posting above (old habit of using that option everytime I type it).

for i in `df|grep \/dev\/ | cut -f1 -d ""`
do
echo searching file system $i
find $i -xdev -type f \( -user web -o -user webadm \)
done
We are the people our parents warned us about --Jimmy Buffett
Sammy_2
Super Advisor

Re: Need find command to look user owenr "web" "webadm" files from /

Pat,
you are right . i am doing on solaris 9 but also needed to do on hpux11.11 . It works fine there and thanks.
John,
Your script seems great for solaris based system.Appreciate it for providing an alternate. only thing is I had to put space between " " to just get the fs from cut. Maybe you meant it like that anyway.
Thanks a bunch.
good judgement comes from experience and experience comes from bad judgement.
Sammy_2
Super Advisor

Re: Need find command to look user owenr "web" "webadm" files from /

Thanks Pat, John. Solution found
good judgement comes from experience and experience comes from bad judgement.