- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Problems with find
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
05-19-2004 07:32 PM
05-19-2004 07:32 PM
I am using the find command to search in a specific directory for files owned by a user.
"find /(dir) -user (user) -print -exec ls -l {} \; > /tmp/file" is the command i'm using.
When I check the /tmp/file file, there are files in there that are owned by root! not just the (user) user.
If I replace the ls -l with a chown (newuser), the files belonging to root would be chown'd to the newuser.
Am I having a "blonde moment" here... HELP
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 07:40 PM
05-19-2004 07:40 PM
Re: Problems with find
# find /
e.g.
# find /tmp/ -user root -exec ls -ld {} \;
the above will only show the files belonging to the specified username or UID. check if UID of root is co-own by another users.
# logins -u
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 07:41 PM
05-19-2004 07:41 PM
Re: Problems with find
find /dir) -user (user) -print > /tmp/file
No need for exec.
Hope that helps.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 07:41 PM
05-19-2004 07:41 PM
Re: Problems with find
Kaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 07:43 PM
05-19-2004 07:43 PM
Re: Problems with find
regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 07:46 PM
05-19-2004 07:46 PM
Re: Problems with find
Try
find /dir -user (user) -type f -exec ls -l {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 07:49 PM
05-19-2004 07:49 PM
Re: Problems with find
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 07:55 PM
05-19-2004 07:55 PM
Re: Problems with find
I will be sorting out the points problem from my previous post very soon.
The user in question is currently set at UID 99, and I'm looking to increase the UID to 199
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 08:43 PM
05-19-2004 08:43 PM
SolutionI think, the problem is in ls -l:
Your find gives you not only files but directories as well. If in a directory, which belongs to the (user) there are files which belongs to root, you see them in the output.
Add additional option into your find command:
find (dir) -type f
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 09:31 PM
05-19-2004 09:31 PM
Re: Problems with find
find /(dir) -type f -user (user) -print > /tmp/file
HTH
Bruno
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2004 11:30 PM
05-19-2004 11:30 PM
Re: Problems with find
UID should be normally be above 100 because below 100 they are supposed to be used by System.
Hope that helps.
Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2004 08:52 PM
05-20-2004 08:52 PM
Re: Problems with find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2004 09:08 PM
05-20-2004 09:08 PM
Re: Problems with find
just in case you ever do change the UID of a user you will need to do a recursive change of owner to the files they own too.
:-) John.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2004 02:25 AM
05-21-2004 02:25 AM
Re: Problems with find
I think what is happening is that the find command has encountered a directory owned by (user) that in fact contains files owned by root.
ie.
".... -exec ls -l {}"
means do a long listing on whatever we just found (in this case a directory). Similar to if you had typed "ls -l /var".
I am not sure, but I think a chown will work as intended provided you don't use the "-R" option. However, I would test the new chown version on junk/test files first, before releasing it on unsuspecting important files.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2004 02:39 PM
05-21-2004 02:39 PM
Re: Problems with find
Try using the find command with egrep -v to cull out the files owned by root. This will work whether the userid you are searching on shares the uid of 0 with root or not.
For example
find . -user ingres -type f -exec ls -l {} \; | egrep -v root
Cheers,
Rossco