Forum Moderators: bakedjake

Message Too Old, No Replies

problem running local java applications (question with no answers)

         

apoleks

1:34 pm on Oct 7, 2005 (gmt 0)

10+ Year Member



I have posted this question at Apache forum but got no response:

I am using Apache 2.0 on Linux Redhat Enterprise WS 4.

I want to be able to run cgi script from a web page. The script calls bash script which runs java code. Both jdk1.5 and java classes are under "/home/my_account/" and cgi script and bash script are in the default "/var/www/cgi-bin" directory.

I can run the script just fine as "root". Not as "apache (www)" though. If I try to run it within the browser, I get the following error message:

/home/my_account/downloads/jdk1.5.0_05/jre/bin/java: Permission denied

I have all permissions set to 755 (I have tried 777, but didn't help). It seems to me that "java" itself is the problem. For example, if I do

"cat /home/my_account/some_file"

instead of running java, that works fine.

I know it must have something to do with httpd.conf settings, but I just cannot figure it out.

Any suggestions? Thanks.

StupidScript

11:27 pm on Oct 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What user did the Java installation?

Who owns the Java install directory?

Have you tried changing ownership of the bin directory/files in question to "apache:root"?

There are several overlapping security issues going on, any of which could get you to that error, including ownership, permissions, and other stuff like not being able to bind to ports under 1023 without being root. Some of these depend on what the program is trying to do, although your problem seems to be simply getting access to the program file at this point.

If Java was un-tarred, config'd, make'd and make-installed as root, then only root can use it. If you did everything as a normal, unprivileged user except for the "make install", which needs to be done by root, then other unprivileged users (like apache) should be able to access the program.

apoleks

5:20 am on Oct 8, 2005 (gmt 0)

10+ Year Member



Thanks,

In my case the problem was SELinux. I solved problem by changing security permissions with "chcon". There is also "brute force" solution of disabling SELinux. I do not know how smart it is to do though.