Apr 10, 2012

Can I change the ownership of all the files of a specific user?


Is there a way to recursively find all files owned by a user and change them to another user/group in Gnu/Linux?

I assume there must be some magic one liner but my command line wizardry skills are not up to that 🙂


Asked by john


Use the find command with the -user option. Something like:

find / -user john

will eventually turn up all files owned by user “john”.

If you want to change their ownership (I would run the find without execution to make sure you have the list you want), then something like:

find / -user john -exec chown harry {} \;

will do it.

Answered by cjc

Related posts:

  1. Change ownership of directory and all contents to a new user from root
  2. Change ownership or permissions on only directories or files, recursively
  3. How do I find all files and directories writable by a specific user?
  4. Change user permissions on files/directories where user = fred recursively
  5. Force specific user for created files?

Leave a comment