LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 10-17-2006, 03:00 AM   #1
pilot11
Member
 
Registered: Sep 2006
Location: Surrey, UK
Distribution: CentOs version 4 X86_64 Dell PowerEdge 2900 2 gig Ram. Raid array 5
Posts: 33

Rep: Reputation: 15
403 Forbidden error was encountered


This is strange, but should be easy to remedy but the error only comes up when I try to access an html or php file in a directory under the root directory of var/www/html/

If I put an html file or php file in the root of html directory, and on another machine on the intranet I can access and view the file without problem. But as soon as I put the file in another directory such as var/www/html/whatever/ I get the 403 forbidden error.

I set permissions of 777 on the directory and still get this error?

I must have a config file wrong or something..... can anyone point me in the right directin please?
is it an ownership problem?
 
Old 10-17-2006, 11:56 PM   #2
carl0ski
Member
 
Registered: Sep 2004
Location: Melbourne, Victoria Australia
Distribution: Support those that support you :)
Posts: 872
Blog Entries: 12

Rep: Reputation: 30
Quote:
Originally Posted by pilot11
This is strange, but should be easy to remedy but the error only comes up when I try to access an html or php file in a directory under the root directory of var/www/html/

If I put an html file or php file in the root of html directory, and on another machine on the intranet I can access and view the file without problem. But as soon as I put the file in another directory such as var/www/html/whatever/ I get the 403 forbidden error.

I set permissions of 777 on the directory and still get this error?

I must have a config file wrong or something..... can anyone point me in the right directin please?
is it an ownership problem?
when you set the permissions are you doing so recursively? aka for all sub folders
-R means continue for all contained folders

try as root in a konsole
chmod -R 666 /var/www/html/*
 
Old 10-18-2006, 02:21 AM   #3
pilot11
Member
 
Registered: Sep 2006
Location: Surrey, UK
Distribution: CentOs version 4 X86_64 Dell PowerEdge 2900 2 gig Ram. Raid array 5
Posts: 33

Original Poster
Rep: Reputation: 15
Thanks for your help here.

I tried as you suggested but still getting 403 forbidden error. It seems it will not allow me to access anything in a directory, but will allow files in the root of html ?

stumped !
 
Old 10-18-2006, 03:43 AM   #4
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Try doing,
Code:
#chmod -R 755 /var/www/html
Can you please let us know what distribution you are using by putting it in your profile. Cheers.
 
Old 10-18-2006, 07:10 AM   #5
pilot11
Member
 
Registered: Sep 2006
Location: Surrey, UK
Distribution: CentOs version 4 X86_64 Dell PowerEdge 2900 2 gig Ram. Raid array 5
Posts: 33

Original Poster
Rep: Reputation: 15
I logged in as root and run that command:

#chmod -R 755 /var/www/html

and still have the error, could this be an ownersip problem.


CentOs version 4 X86_64 Dell PowerEdge 2900 2 gig Ram. Raid array 5
 
Old 10-18-2006, 08:53 AM   #6
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
Do you have selinux enabled? If so, that could be causing your problems. You could disable selinux temporarily by doing "setenforce=0" in a terminal. After that try accessing a webpage. If things work ok, then you need to do,
Code:
#chcon -R -t httpd_sys_content_t /var/www/html
 
Old 10-18-2006, 09:09 AM   #7
pilot11
Member
 
Registered: Sep 2006
Location: Surrey, UK
Distribution: CentOs version 4 X86_64 Dell PowerEdge 2900 2 gig Ram. Raid array 5
Posts: 33

Original Poster
Rep: Reputation: 15
I haven't enabled it, I thinki it is part of the fedora core?
The chcon is a new command and linked to selinux?

I deleted the directory then as root created a new folder with root ownership then unpacked files into the new directory, and the error message 403 disappeared and I can read php and html files now.

who should own directories in the html directory root or apache ?
 
Old 10-18-2006, 11:28 AM   #8
reddazz
Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 73
My html directories are owned by root, but the apache user runs httpd.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache 403 Forbidden Error On Every File agtlewis Linux - Software 5 09-01-2006 11:25 PM
HTTP 403 (Forbidden) error lothario Fedora 6 02-08-2005 04:43 AM
Error 403 Forbidden access in Apache anoop_cn Linux - Software 1 09-21-2004 09:32 AM
apache error, 403 forbidden afrodocter Linux - Software 6 08-09-2004 08:35 PM
apache 403 error forbidden? bulliver Linux - General 4 01-31-2003 07:47 AM


All times are GMT -5. The time now is 10:15 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