- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Need to change owner on all files owned by certain...
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
11-16-2004 08:14 AM
11-16-2004 08:14 AM
I tried the find command w/ -exec...... to no avail.
I want to find all files under this mount point with ownership of userA, then change such files to be owned by userB. Please advise. There are hundreds of files....
Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2004 08:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2004 08:46 AM
11-16-2004 08:46 AM
Re: Need to change owner on all files owned by certain user
find /mount_point -user userA -exec chown userB {} \;
That should change everything recursively under that mount point that UserA owns to be owned by UserB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2004 08:46 AM
11-16-2004 08:46 AM
Re: Need to change owner on all files owned by certain user
cd to desired starting directory/mountpoint
find . -user userA -exec chown userB {} \;
That should do it; you could make it more efficient via xargs but for a one-shot deal, it hardly matters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2004 09:23 AM
11-16-2004 09:23 AM
Re: Need to change owner on all files owned by certain user
Try chown -R
chown -R userB some_dir
everything under some_dir would now be owned by userB
to change group also
use chgrp -R
or
chown -G userB:new_group some_dir
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2004 02:25 AM
11-17-2004 02:25 AM
Re: Need to change owner on all files owned by certain user
How do I change the ownership of the symbolic links? The target file of the link changed just fine, but the link itself is still owned by userA. Do I have to remove/add the link again under the userB ownership? Or is ther an easier way?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2004 02:36 AM
11-17-2004 02:36 AM
Re: Need to change owner on all files owned by certain user
If you want to change link, you will have to recreate it. this can be done this way :
find . -type l -user userA -exec ls -ld {} \; | awk '{print $9,$11}' | while read dest src
> do
> rm $dest
> su userB -c "ln -s $src $dest"
> done
(such commands must be tested on small directory before breaking anything)
Regards,
Fred
"Reality is just a point of view." (P. K. D.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2004 02:40 AM
11-17-2004 02:40 AM
Re: Need to change owner on all files owned by certain user
Man 1 chown for details. If you want to change the mode of a symbolic link that's more difficult but rarely needed. To do that, you must make use of an undocumented system call lchmod(); search the Forums for "lchmod" and you should find a C program that I posted to do this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2004 02:42 AM
11-17-2004 02:42 AM
Re: Need to change owner on all files owned by certain user
lchown -h userB symlinkname
should be:
chown -h userB symlinkname
I was thinking of the underlying system call as I tend to do rather than the command itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2004 03:01 AM
11-17-2004 03:01 AM
Re: Need to change owner on all files owned by certain user
find / -user 1510 | xargs chown root:system {}
Rgds...Geoff