Suppose user "qqq" have file /home/qqq/bigfile.dat and want to pass it to user "aaa" without help of root (it need to be owned by "aaa"). What should users "qqq" and "aaa" do?
uid=qqq$ mv bigfile.dat /home/aaa/
uid=aaa$ chown aaa /home/aaa/bigfile.dat # Operation not permitted
Of course it can be done by using ACLs (
uid=qqq$ setfacl u:aaa:rw- /home/aaa/bigfile.dat) or by making temporary copy (
uid=aaa$ mv bigfile.dat bigfile.dat_ && cat bigfile.dat_ > bigfile.dat && rm bigfile.dat_), but both ways seem to have disadvantages.
Both users agree (can issue some command) to "pass" the file. It should be quick, preserving inode and other attributes etc.
How to do it cleanly?