LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   403 Forbidden when accessing some .PNG files (http://www.linuxquestions.org/questions/programming-9/403-forbidden-when-accessing-some-png-files-442093/)

jhorvath 05-06-2006 12:05 AM

403 Forbidden when accessing some .PNG files
 
this one has me stumped..

i have various png files im trying to host under apache/2.2.0, two of them work, the rest do not and i can't for the life of me, figure why.

some background music..

Code:

[jhorvath@blackhawk img]$ ps -ef|grep httpd
root      2255    1  0 May05 ?        00:00:00 /usr/sbin/httpd
apache    2282  2255  0 May05 ?        00:00:00 /usr/sbin/httpd
apache    2283  2255  0 May05 ?        00:00:00 /usr/sbin/httpd
apache    2284  2255  0 May05 ?        00:00:00 /usr/sbin/httpd
apache    2285  2255  0 May05 ?        00:00:00 /usr/sbin/httpd
apache    2286  2255  0 May05 ?        00:00:00 /usr/sbin/httpd
apache    2287  2255  0 May05 ?        00:00:00 /usr/sbin/httpd
apache    2288  2255  0 May05 ?        00:00:00 /usr/sbin/httpd
apache    2289  2255  0 May05 ?        00:00:00 /usr/sbin/httpd
jhorvath  3747  3513  0 00:55 pts/1    00:00:00 grep httpd
===============================================================

[jhorvath@blackhawk img]$ groups apache
apache : apache web
===============================================================


[jhorvath@blackhawk img]$ pwd && ls -l
/var/www/html/img
total 100
-rw-rw-r-- 1 jhorvath web  191 May  6 00:21 bc.png
-rw-rw-r-- 1 jhorvath web  220 May  5 20:56 bl.png
-rw-rw-r-- 1 jhorvath web  235 May  5 20:56 br.png
-rw-rw-r-- 1 jhorvath web  185 May  5 21:25 cl.png
-rw-rw-r-- 1 jhorvath web  189 May  5 21:26 cr.png
-rw-rw-r-- 1 jhorvath web 1053 May  6 00:41 test2.png
-rw-rw-r-- 1 jhorvath web 7190 May  6 00:15 test.png
-rw-rw-r-- 1 jhorvath web  292 May  6 00:17 uc.png
-rw-rw-r-- 1 jhorvath web 1055 May  6 00:24 ul_menu.png
-rw-rw-r-- 1 jhorvath web  277 May  6 00:25 ul.png
-rw-rw-r-- 1 jhorvath web 1182 May  5 21:22 ur_close.png
-rw-rw-r-- 1 jhorvath web  327 May  5 21:24 ur.png
===============================================================

if i hit http://localhost/img/ only the test* images are listed for some reason, i can't access them directly through apache at all? did i miss something perhaps?

thanks,
jeremy

spooon 05-07-2006 05:25 AM

try
Code:

restorecon -R /var/www/html/img
SELinux will only let files with a certain context be accessible to the web server. If you created them elsewhere and moved them there they won't have the correct context.

jhorvath 05-07-2006 04:45 PM

i recreated all of them (twice,.. first time failed again), but i kept teh originals around incase someone had a solution i could try.. worked like a charm, thanks man.

not so surprising anymore, that it didnt work..

Quote:

One problem you may run into is the difference between the mv and cp commands. Suppose that you have some new content (about.html) to add to your website. After creating it in your home directory, you later do something such as: sudo mv /home/walters/about.html /var/www/html. The problem here is that mv by default preserves the context associated with the file, whereas cp, since it creates a new file, inherits the parent directory's context.
taken from http://fedora.redhat.com/docs/selinu...ple-setup.html

originally i had a whole directory (MoVed from ~/), that i couldnt browse with the images, then i created the img directory and MoVed them into that..

well, at least now i know ^^

thanks again for pointing me towards SElinux


All times are GMT -5. The time now is 09:48 AM.