I would like to allow a certain user who does not own the files in a directory to execute
chmod on them. Interactively, I know that I can do this by configuring
sudo with the sudoers config file(s), and I can also define an alias like
alias chmod='sudo chmod'
in .bashrc, .profile, or .bash_profile so that the user does not need to type
sudo chmod each time anymore. This approach breaks though if
chmod is not executed from the command line within a bash shell, but from a program. How could I make this still work?
The background is in setting up Syncthing, which I want to use to synchronize files from different users. Also,
syncthing shall not be running as
root but as user
syncuser user does not have permissions to execute
chmod on files it does not own but which it has synced (read/write permissions managed by groups), and this is where it fails.
This situation must occur more frequently. I am pretty much convinced that there is another solution than running
root, but at the moment I don't see how...