I am a user of the root account on the server named A. And I also own the accounts of user1 and user2.
When I create a file or directory in the account of user1, I want the owner of the file to be user2.
Setting the group is possible by using the setuid: Setting default permissions for newly created files and sub-directories under a directory in Linux.
For the user account, is there any way?
Example. Make file - traditional way:
[user1@srv1 tmp]$ id
uid=4001(user1) gid=4001(user1) groups=4001(user1)
[user1@srv1 tmp]$ touch test_user1
[user1@srv1 tmp]$ ls -al test_user1
-rw-rw-r-- 1 user1 user1 0 2014-01-09 15:24 test_user1
Example. Make file - what I want:
[user1@srv1 tmp]$ id
uid=4001(user1) gid=4001(user1) groups=4001(user1)
[user1@srv1 tmp]$ touch test_user1
[user1@srv1 tmp]$ ls -al test_user1
-rw-rw-r-- 1 user2 user1 0 2014-01-09 15:24 test_user1
I do not wish to have to change the permissions of the file using the chown
command.