1

I use the (excellant) unison to sync two file servers and I've just realised i've synced a number of files without using the switch in unison that maintains the file user ownership. these files now have a user of root (coz i have to run unison as root)

Can I chown to a specified user BUT only change the files that now have the owner root and do so recursively in the directory in question? Sure i can but not sure of the arguments to "find files with owner 0 and change them to owner xxxx".

THX for any help...

1 Answer 1

4

Run find /search/dir -user root and check it lists the appropriate files.

Automatically changing system files from root ownership will do bad things to your system, so make sure this only finds files you want to change.

Then sudo find /search/dir -user root -exec chown myuser {} \; will change the ownership of those files.

1
  • THANKS for the warning. I appreciate this is a dangerous manoeuvre! It's critical this only happens in my specified folder (which is a sub directory of /home) so I will do the find first! THX again
    – user114642
    Dec 14, 2012 at 9:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .