I have an application that needs to run with root permissions.
Using setuid bit on the application file seems like a logical choice. My understanding of setuid is that the files should be owned by root, and only be writable by root, or otherwise an untrusted user with write permissions could edit the file, and execute anything in root context.
However, this complicates deploying the application, since I need to set the files owner to be root after it is deployed (pulled down from remote Git repo), something like:
sudo chown root:root /app/rootprog sudo chmod 6711 /app/rootprog
Is there a way to avoid this, or a better way to develop and deploy an application that has to run as root?