I'm trying to run a shell script owned by a non-privileged user from PHP on an Ubuntu server. Issues with permissions make running it with exec()
impractical, as it's www-data
that's running it. I've googled a bit and found varius references to suExec (which seems too much of a hassle to get working for such a small problem), setting the suid bit, and an interesting approach here on Stackoverflow involving a Python server listening for commands sent by PHP.
Anyway, of all of these solutions, I lean towards the one involving setting the suid bit, tried it and it didn't work : chmod u+s script.sh
, and my Apache logs still show permission errors, so I know the script is not running as it's owner but as www-data
.
What do I have to do to get this working, and is there a simpler solution for this problem ?