How can I create directories so:/data/data/user1/data/user2and make sure that whenever root writes inside them, depending on which directory it writes to, different owners are set.Example:Root writes to /data -> normal file creation Root writes to /data/user1 -> any files created therein are automatically owned by user1 and readable by others (the same should apply if user1 writes to the dir himself)
Automatically change file permission upon write to a folder
filesystems;permissions