LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-06-2006, 12:05 AM   #1
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Rep: Reputation: 30
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
 
Old 05-07-2006, 05:25 AM   #2
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 48
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.
 
1 members found this post helpful.
Old 05-07-2006, 04:45 PM   #3
jhorvath
Member
 
Registered: Sep 2002
Location: OH, USA
Distribution: 2.6.16-1.2096_FC5 #1
Posts: 245

Original Poster
Rep: Reputation: 30
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

Last edited by jhorvath; 05-07-2006 at 05:07 PM.
 
  


Reply

Tags
apache, context, selinux


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
403 Forbidden 1veedo Linux - Newbie 2 11-27-2005 05:46 PM
403 Forbidden patpawlowski Linux - Newbie 1 04-26-2005 09:20 AM
403 Forbidden JanDeMan Linux - Newbie 7 04-12-2004 03:02 PM
403 forbidden Flawless Slackware 4 03-04-2003 07:24 AM
403 Forbidden??? morbo Linux - Networking 11 07-04-2002 10:17 AM


All times are GMT -5. The time now is 02:58 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration