I am trying to run a shell script belonging to a non-privileged user from PHP on an Ubuntu server. Permission problems run it exec()impractical since it www-dataruns it. I searched Google a bit and found varius links to suExec (which seems like too much trouble to work on such a small problem), setting the suid bit and an interesting approach here in Stackoverflow, including a Python server that listens for passed commands in PHP.
In any case, of all these solutions, I tend to set the suid bit, tried it, and it didn’t work: chmod u+s script.shand my Apache logs still show permission errors, so I know the script does not work as its owner, but how www-data.
What do I need to do to get this to work, and is there a simpler solution to this problem?
source
share