LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-25-2003, 06:33 PM   #1
quozt
Member
 
Registered: Jul 2003
Location: Leeds
Distribution: Knoppix
Posts: 60

Rep: Reputation: 15
Apache 403 Forbidden


k installed webmin and apache came with RH9 ive started my httpd via httpd -k start ......but when i go to localhost or my domain name (which forwards to my i.p. addy i get

Forbidden

You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.


any ideas?
 
Old 08-30-2003, 06:08 PM   #2
docv
LQ Newbie
 
Registered: Aug 2003
Distribution: Red Hat
Posts: 16

Rep: Reputation: 0
Make sure your document root directory, subdir's and all the files are readable by the user that Apache is running under. This is usually apache.apache or www.www, but you can find out by looking inside the file '/etc/httpd/conf/httpd.conf'.
 
Old 09-06-2003, 12:56 PM   #3
bikini
LQ Newbie
 
Registered: Aug 2003
Posts: 5

Rep: Reputation: 0
Finally fixed this on mine... I think my brain was dead or something... I have been doing this too long to be caught like this.

docv triggered the thought...

as root cd to the document root directory

su apache ( or whatever apache runs as )

if ls returns permission denied then fs permissions are the problem.

exit and go to the directory level above your document root and change the permissions of the directory to 755.

go back to the document root and su apache again and you should be able to list the files. Make sure that you can read them also.

Up and working... Thanks Docv

Ron
 
Old 09-09-2003, 12:11 AM   #4
wheel
Member
 
Registered: Sep 2003
Posts: 33

Rep: Reputation: 16
Quote:
Originally posted by bikini
if ls returns permission denied then fs permissions are the problem.
Assuming this is the problem - can you tell me what the fix is please?

Here's my symptoms:
-fresh apache install on mandrake 9.1.
- copied /home/userbob/website directory from current setup (files set to owner/group userbob)
- copied vhosts.conf file from current setup
- restarted apache
- get permission denied error. Note - if I put the original blank vhosts.conf file back, I get the normal 'don't call apache' page from somewhere (/var/www or something)? If I chmod 777 the directory it doesn't help.

I did as suggested, su'ed to apache and tried to go to userbob directory and got permission denied.

So clearly the apache user and userbob user need to be somehow related. Do I put them in the same group (and how)? General suggestions welcome, I think I'm almost there.... .
 
Old 09-09-2003, 06:12 AM   #5
docv
LQ Newbie
 
Registered: Aug 2003
Distribution: Red Hat
Posts: 16

Rep: Reputation: 0
Sounds like you didn't include the recursive switch in your chmod command. Try this as root;

chmod -R 755 /home/userbob/website

Not only does the directory have to be 755, but all (most all) the files should be 755 as well.
 
Old 09-09-2003, 11:45 AM   #6
wheel
Member
 
Registered: Sep 2003
Posts: 33

Rep: Reputation: 16
Thanks docv, but that's not it. I've chmod 777 and set chown to apache.apache (recursively) and same bang-head-against-screen results.

I'm fairly certain I have a permissions problem though. My logs indicate a permission problem, so I tried running apache as the same user that owns the directory - and it comes up fine!
So how do give apache permission to read directories that aren't it's own, or how do I tell directories that apache can access it?
 
Old 09-09-2003, 04:23 PM   #7
docv
LQ Newbie
 
Registered: Aug 2003
Distribution: Red Hat
Posts: 16

Rep: Reputation: 0
What doesn't make sense is that you can not access the site after chmod'ing it to 777???!!!!!

OK, probably a stupid question (but I've been stumped for a while by stupid things like this in the past), are you sure httpd is running under username apache?

Do you have '/home/userbob/website/' as the httpd document root, or is httpd set up to allow users home directories as their document root(s)??

Last edited by docv; 09-09-2003 at 04:35 PM.
 
Old 09-09-2003, 04:32 PM   #8
infinity6
Member
 
Registered: Dec 2001
Posts: 66

Rep: Reputation: 15
Adding userbob to group apache is easy. Open /etc/group with your favorite editor. Find the apache group. At the end of the line there should be a : after the colon, add the user you would like in that group. If you are adding more than one user, seperate them with commas (NO SPACES!!)

If you want to be GUI about it, you can use the Red Hat user tool. From a command prompt (as root) type redhat-config-users. Voila! add more groups, add users to other groups, but just remember that groups under GID 500 sometimes have special perrmissions on the system and adding users to these groups could endanger your system.
 
Old 09-09-2003, 04:34 PM   #9
infinity6
Member
 
Registered: Dec 2001
Posts: 66

Rep: Reputation: 15
Ooops! Forgot to add that when you are going to change permissions for the directory, you should now do it as chown -R userbob:apache /(whatever directory you want to change) Then type chmod -R 755 /(whatever directory you want to change) so that the apache group will have read/write/execute permissions.
 
Old 09-12-2003, 03:46 PM   #10
bikini
LQ Newbie
 
Registered: Aug 2003
Posts: 5

Rep: Reputation: 0
The problem I was having was that with the security set to higher... is that if you change the permissions of /home... msec goes in behind you and changes the permissions back to what they were.

So you either have to change the configuration of msec or create a new document root such as /www and msec will leave it alone without changing enything else...

Ron
 
Old 02-24-2004, 04:59 PM   #11
lopette
Member
 
Registered: Feb 2004
Location: Switzerland
Distribution: Debian
Posts: 66

Rep: Reputation: 15
same 403 crap

well I know I have a problem with computers, cuz they tend to behave in a really weird manner as soon as I get close to them. but still, it doesn't explain everything, esp when working remotely with ssh. anyway:

default docs directory for my apache server was
/var/www/ www-data:www-data (755)

I didn't like it, so I copied the whole dir elsewhere
/home/pg21_private/www/docs/
and changed the config of the server to use it as default dir, chown'ed and chmod'ed recursively it to the correct values.
When trying to view the page, got an error 403.

I checked the config, could not see anything different between the two dirs, which where an exact copy of each other.

I changed the apache config to use /var/www/ as the docs dir, it worked
changed the apache config to use /home/.../docs/ as the docs dir, it worked NOT
changed the apache config to use /var/www/ as the docs dir, it worked NOT ANYMORE
changed the apache config to use /home/.../docs/ as the docs dir, it worked STILL NOT
...and it still doesn't work since then

so is it just me or is there something wrong

hum, I either got inspired, or my server decided to be nice with me
I chmod'ed the parent dirs o+x, now it seems to work. hope it helps other people too
 
  


Reply



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
apache: 403 forbidden johnty01 Linux - Networking 5 04-05-2008 02:20 PM
apache 403 forbidden? wezhousheng Linux - Networking 5 05-13-2005 12:15 AM
Apache 403 Forbidden mrmike Linux - Newbie 3 07-10-2004 11:31 AM
Apache Webserver 403 Forbidden Errors (User not in apache group?) Mankind75 Mandriva 4 07-08-2004 05:30 AM
apache 403 error forbidden? bulliver Linux - General 4 01-31-2003 07:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:08 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration