I already know I cannot use chown willi-nilly as a normal user however in my situation I have two users: user1
and user2
where user1
is allowed, by the Sudoers file, to sudo in as user2
.
Is it still not possible for user1
to give ownership of the file to user2
?
The best I have come up with so far is to have user1
perform:
user1@localhost$ sudo --user user2 cp fileOwnedByUser1 /tmp/fileOwnedByUser1
user1@localhost$ rm fileOwnedByUser1
user1@localhost$ sudo --user user2 mv /tmp/fileOwnedByUser1 fileOwnedByUser1
However, this seems clunky and ineficient. Is there a better way for user1
to do this? The only thing that occures to me so far, is to put user1
as being able to run "chown" as root in the Sudoers
file.
setfacl -d -m u:user2:rwx
on a directory so that all files created there by user1 are writable by user2?user1
is setting up and configuring a file structure inuser2
's home directory. It would be extremely weird and user-unfriendly to haveuser2
then have files in their home dir that they don't own.