- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- finding filesystems /dirs/files belonging to a use...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 09:44 PM
07-29-2002 09:44 PM
I'm trying to find directories and files within a filesystem belonging to a particular user and change their uids.
The problem is there're many other filesystems containing dirs/files which may belong to a particular user.
I did the following below:
#cat findUser.sh
for i in `cat $1`
do
find $i -user joe_black -exec chown kevin_lee $i {}\;
done
$1 is the lists of filesystems to be searched for that particular user.
A sample of $1 would be:
#cat file1.txt
/fs1/test_tools/
/fs2/auto_cad/lib
/fs3/regression_test/
.... (the list continues ...)
I've tried breaking the list and placing smaller numbers of filesystem lists into a other files. But the search time is simply to slow given the enormity of the filesystems structure.
Could some one help me out on providing more efficient ways or some scripts to improve the efficiency of this task?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 10:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 10:15 PM
07-29-2002 10:15 PM
Re: finding filesystems /dirs/files belonging to a user
I would rather do it like this (provided the file with the filesystems isn't too big ;-)
find $(cat /file/with/filesystems) -user joe_black -print | xargs chhown ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 10:26 PM
07-29-2002 10:26 PM
Re: finding filesystems /dirs/files belonging to a user
There're lots and lots of sub-directories and files within each of the searched filesystems.
Ralph,
Do you mean to say I should just eliminate the for-loop and call:
find $(cat /filesystems/) -user joe_black |xargs chown kevin_lee ??
I'd need to refer to the list of all available filesystems on my system and find this user joe_black and do a chown.
Could you please help me out?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 10:51 PM
07-29-2002 10:51 PM
Re: finding filesystems /dirs/files belonging to a user
Regards,
Trond
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 10:58 PM
07-29-2002 10:58 PM
Re: finding filesystems /dirs/files belonging to a user
yes that's what I meant, forget about the loop.
But if you are interested in all locally mounted filesystems of your system, I think you do not need to hold an extra list in a file.
I would rather parse the output of mount or better bdf
e.g.
find $(bdf -l|awk '{print $NF}') -xdev -user joe_black | xargs chown new_owner
Beware to use the -xdev flag of find (read the find manpage) to prevent subdecending into other submounts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 11:01 PM
07-29-2002 11:01 PM
Re: finding filesystems /dirs/files belonging to a user
a little flaw, I forgot about the heading, which we have to get rid of.
Just insert a wee sed like this (there will probably be no mount on 'on' ;-)
find $(bdf -l|sed '1d'|awk '{print $NF}') ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 11:02 PM
07-29-2002 11:02 PM
Re: finding filesystems /dirs/files belonging to a user
find $(bdf -l|awk 'NR>1 {print $NF}')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 11:10 PM
07-29-2002 11:10 PM
Re: finding filesystems /dirs/files belonging to a user
I again forgot to think before I posted (thus making my last three posts a complete embarrasement of the senses)
Forget the bdf stuff altogether because this is the same as "find / ..."
%-P
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 11:49 PM
07-29-2002 11:49 PM
Re: finding filesystems /dirs/files belonging to a user
What does the %-P option do? I'm not able to find this option in the manpages for find.
Do I just say:
find ... %-P |xargs chown kevin_lee ??
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 11:55 PM
07-29-2002 11:55 PM
Re: finding filesystems /dirs/files belonging to a user
this is no option at all but a silly kind of smily.
Just turn your head to the left and look at it.
The characters should resemble a confused mind (i.e. me) that sticks out his tongue.
:-)