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
Written by Jasson Cascante
Related protips
1 Response
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Command line
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#