I'm copying one users home directory to be the home directory of user #2, and therefore need to chown the contents to the new user. Running:
find /home/user2 -user user1 -exec chown user2 '{}' \;
find /home/user2 -group user1 -exec chgrp user2 '{}' \;
works ok, but (due to the ./.. files I suppose), somehow the root /
was chown'ed to user2. However, /home
remained owned by root:root.
How can I be sure what find will do? How can I restrict it from moving up the tree (toward root), even stopping it before it modifies the working directory itself?