I have a bash script which runs without needing to be root.
But when I run it via shell_exec()
(or system()
, or exec()
) like this:
return system("/home/tom/rrd/rrdtool-drawgraph.sh $interval $multiples - debug 2>&1;");
I get the following message:
sh: /home/tom/rrd/rrdtool-drawgraph.sh: Permission denied
(Strangely, the message is repeated. Not sure if that's relevant? Edit: it doesn't seem to repeat when I use backticks instead of shell_exec
. Go figure.)
I've tried using 777 file permissions. I've tried changing the owner and group to www-data
. I've changed the directory it spits its output into to have equally permissive permissions.
It still won't run.
The only thing I can think of is that the script is in my home directory. If this is the problem, I'd be surprised (because my web root is also in my home directory), but I'm prepared to be corrected. If this is the issue, can I fix it without needing root priveliges?
If it's not to do with being in my home directory, what is the problem? And how do I fix it?