We need some scripts to generate config files for network services such as DHCP, DNS and Network based on user input. These require root access, but I don’t know how to run the PHP application as root. It’s run through a public web interface.
Share
Awww… granting root rights to PHP or the web server is never a good practice, no matter how secure your setup.
How about having PHP write the changed configuration files into a temporary directory:
and a
sudocron job running a shell script fetching them from there, and copying them to the proper location (also taking care of restarting services and all that), on a five-minute basis?It would be a bit safer than having the Web/PHP user write the configuration files directly, plus it would be relatively easy to set up a versioning process that allows to roll back a configuration file to an earlier version.