I am attempting to create a very simple web interface for changing some system settings on a network appliance. I am fairly new to PHP and becoming painfully aware of how easy it is to do things in hacky ways, so I am trying to write everything with the best practices in mind.
That said, what would the best practice be for editing files owned by root/some other admin account? Would it be to create a protected shell/perl/whatever script that gets executed by PHP? Using setuid
was another option that came up, but that doesnt appear to have any way of restricting users.
I hope that wasn't too vague, let me know if you need any more details and I'll be glad to share.
Further Detail: Just to clarify - by edit system files I mean specifically ifcfg's and some proprietary licensing information. So for simplicity's sake, lets just say a simple web interface to change the ip/subnet/gateway/dns settings on a linux-based network appliance.