Last Updated: February 25, 2016
· yeco

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

1 Response
Add your 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 ·
Filed Under

Awesome Job

Frontend Web Developer for Games
Leamington Spa (United Kingdom)
Full Time