gzhxoq
Last Updated: February 25, 2016
·
444
· yeco
891d598f28745d268ec3cac10390045a

Transfer ownership

Simple snippet to change all files belonging to one user to another user.

% find /directory-name -uid current_owner_id_number -exec chown newuser:newgroup {} +

Getting the user id is as simple as:

% id username
Say Thanks
Respond

1 Response
Add your response

4924
D42a7264714dee5006b9c99d2567a320

You can do it solely with chown thanks to -R (recursive) and --from options:

chown -R --from current_owner newuser:newgroup /dir-name

And I believe you don't need to fetch uid of current user, simply pass his name in --from option

over 1 year ago ·
Filed Under