- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Search for ownership of files recursively
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
12-20-2007 10:18 AM
12-20-2007 10:18 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 10:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 10:23 AM
12-20-2007 10:23 AM
Re: Search for ownership of files recursively
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 10:24 AM
12-20-2007 10:24 AM
Re: Search for ownership of files recursively
# find / -nouser
See the manpages for 'find' for more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 10:30 AM
12-20-2007 10:30 AM
Re: Search for ownership of files recursively
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 11:31 AM
12-20-2007 11:31 AM
Re: Search for ownership of files recursively
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 11:35 AM
12-20-2007 11:35 AM
Re: Search for ownership of files recursively
doesnt work either because the user has already been removed from the system :-(
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 12:04 PM
12-20-2007 12:04 PM
Re: Search for ownership of files recursively
If you have deleted the account (name) and don't want every unowned file (that is, one's whose uid don't map to a password database) then you need to know the UID that represented the account you deleted:
# find / -user 1000
...will return any files and directories owned by uid=1000.
When you specified a name, like:
# find / -user mark
...a mapping of "mark" to its uid was attempted but the absence of a named account voided the operation.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 12:12 PM
12-20-2007 12:12 PM
Re: Search for ownership of files recursively
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 12:56 PM
12-20-2007 12:56 PM
Re: Search for ownership of files recursively
Then I'd delete the recovered one. Then I'd go and find all of whomevers stuff and determine what to do with it. By this, I mean I wouldn't just go and delete all of his files. What if they are in production code areas?? After this, then delete him once again from the /etc/passwd file.
Or, if you don't like putting him back in the /etc/password file, then just look up his uid and do your find from there.
But, I'd be careful of just kicking off a iterative delete from the server without looking at ownership.
Also, FWIW. Deleting old user accounts is a problem for security. Just lock them and keep them in their own section of GONE users, and then do the right thing (whatever that is) for their files and remove their home directories. Point their shell to /dev/null or something that will never run. Reason? If you reuse that uid number for a new user, they will automatically inherit all files previously owned by the previous owner possibly left on the server. Some of those files could contain secure data not meant for the general user/developer population. The possibility goes up when you've got lots of servers and you believe you *already know* which servers he or she used.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2007 01:06 PM
12-20-2007 01:06 PM
Re: Search for ownership of files recursively
Lastly, once you decide what 'uid' represents the deleted name, you can leverage 'find' to transfer the ownership of the orphaned files and directories to a valid account:
# find / -user 1000 -exec chown newuser:newgroup {} \+
This assumes that it was uid=1000 that was deleted from the password database and that "newuser" and "newgroup" are valid mappings in your current database.
NOTICE that the 'chown' is NOT recursive. You probably want to change the ownership of directories and files found but certainly do not want to blindly recursively change the ownerships of all files found in a particular directory!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-21-2007 05:39 AM
12-21-2007 05:39 AM