Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

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.

share|improve this answer
    
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 '12 at 9:47
    
That worked just as required. THANKS again –  user114642 Dec 14 '12 at 11:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.