Ubuntu: chown select files only


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...


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.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »