One of my friends had a strange experience.He had a script stored inside the Apache document root and it could not be executed when the script was called directly using " ./script ".The executable permissions and all were fine but there was no way to run it there.But when the same script was called with "bash script "
It worked fine. Again if the script was copied somewhere else outside the Apache doc root it would work when directly executed also. The strace showed that open(/dev/tty) was returning a failure return code only when executed from the apache doc root. The strace o/p of both successful and unsuccessful executions of the script were put to diff and all the troubles seemed to begin from there.A lot of head scratching later we saw that Selinux was enabled on the box and that was the cause for all this.It was putting the Apache doc root in a chroot jail and was not allowing any script to be executed there.
Then changed the setting in /etc/selinux/config from enforcing to disabled and
echo 0 > /selinux/enforce
and lo things were back to normal
No comments:
Post a Comment