Consider the following scenario:I have rwx access to a directory as a member of the group id of the directory. The system admin does not let users run chown (see this thread for details)How can I take recursive ownership of the directory? I believe I can do the following, assuming that I want to own Acp -R A Brm -R Amv B Abut this is tedious and can require a large amount of space if A is large.
chown not permitted, but I have write access. How can I take recursive ownership?
permissions;files
You only really need to take ownership of directories. Ordinary files will take care of themselves the next time you modify them, symbolic links and pipes don't matter, and I'm going to assume there are no devices or other exotic types.You can make a recursive copy of the directories, but make hard links from the regular files instead of copying them. With GNU coreutils (Linux, Cygwin):cp -al A BEvery regular file A/dir/file is hard-linked as B/dir/file. You can then remove the source tree.If you don't have GNU coreutils, you can use rsync instead:cd Arsync -a --link-dest=$PWD . ../BTo make sure that deleting A will not actually remove any file, check that all regular files have a hard link count of at least 2  the following command should not output anything:find A -type f -links 1