title: Editing System Files With Elevated Permissions and PHP
body: <p>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.</p>
  
  <p>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 <code>setuid</code> was another option that came up, but that doesnt appear to have any way of restricting users. </p>
  
  <p>I hope that wasn't too vague, let me know if you need any more details and I'll be glad to share.</p>
  
  <p>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.</p>