I want a particular user to recursively change owner and group of all the contents of a particular directory, and only that directory. The directory is a kind of "inbox", where a service writes files, and subdirectories.
Currently, I have an administrator sudo chown
, but I would prefer the destination owner to do it themselves, without that user having any more permissions then required. Let's say the original owner is "headsman", and the final owner should be "audience". Neither user is in the same group.
sudo chown -R audience:watchers /usr/files/pathofdir
Is not quite right, because I don’t want audience to have unlimited authority to use chown. My first guess was to try to add "audience" to /etc/ sudoers with permission to /usr/bin/chown and /usr/bin/chgrp. But that is too much authority.
I thought of writing a script exclusively for audience, but I don’t know how to make that script have the correct permissions and no more.
What is a good way to do this?