bash - what is the best way to run shell script (with root privilege) via php?
I've made a simple bash script for server admininstration and I cannot figure how can I run it in safely inside a php page: I'd like to create a php admininstration page but I obviously don't want to hard-code root password anyware. Let's make an example (this is a foo script, of course)
#!/bin/bash touch /$1
this simple/stupid script will not work if the user who run it as no writing permission on /.
Actually the script add apache virtualhosts, ftp users and so on... any ideas?
and set up
sudoso it can execute the following command for the current user as a root.
http://www.sudo.ws/sudo/sudoers.man.html - here is the sudoers manual, the configuration file, that you have to modify.
This is example from my
/etc/sudoers. Here I allowed to run command
/sbin/iptables -L FORWARD -n -v -xas
rootwithout asking a password for user