[CentOS] bash file direct execution [half-solved]

dan1 dan1 at edenpics.com
Tue Aug 2 14:18:27 UTC 2005


>This is weird, could it be SELinux related? Have you got SELinux
>enabled? And if so, can it be switched off to check if it's the cause
>of the problem?
>
>Will.

Will, you found out the problem !!! Big thanks !
The problem was seated in the SElinux which was enforcing. Disabling it 
solved the problem.
Now as I would still prefer to keep SElinux, I don't know exactly what I 
should do to make that work with it enabled.

Here is the list of the SElinux properties (the context) for these files:

Correct file in /, ls -alZ:
-rwxr-xr-x  root     root     root:object_r:root_t             test.sh

Buggy file in /home, ls -alZ:
-rwxr-xr-x  root     root     root:object_r:httpd_sys_content_t test.sh

I have changed that context for all the /home directory to 
httpd_sys_content_t for apache to be able to display those files, this is 
the reason of the difference.
However, I have installed JAVA tomcat and it has also automatically set 
/usr/java/jakarta-tomcat/bin/startup.sh in the same context without me 
asking that. This is also the reason why this script doesn't work there.
However, why did this file set itself in this context, any idea ? BTW this 
was not the case on my other box where I also have JAVA installed and the 
statup.sh script works perfectly.

Also what context should I put my files to, if I want to make sure that I 
can execute them and also be able to see them with apache (a link on one 
users's subdirectory) ?
In the worst case I can still disable SElinux, but I'd rather keep it for 
security reasons.

Thanks a lot,
Daniel






More information about the CentOS mailing list