LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 10-16-2005, 06:22 PM   #1
johnty01
LQ Newbie
 
Registered: Aug 2005
Location: vancouver, bc
Distribution: fc 4
Posts: 26

Rep: Reputation: 15
apache: 403 forbidden


Hi,

I'm trying to put up two files via http using Apache. One is a .zip archive and the other is a .txt document. The text file shows up in the directory listing, but not the text file. If i type the name of the zip file manually, it says 403:forbidden.

the file attributes for the two files are:

-rwx------ (zip file)
-rw------- (txt file)

- do these attributes even apply to apache? any ideas what i could do? its probably something really simple i'm not seeing...

thanks,

johnty
 
Old 10-16-2005, 08:10 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,059

Rep: Reputation: 295Reputation: 295Reputation: 295
The user which the Apache server runs as must have permissions to read the files (else how is it supposed to serve them?). Generally apache will run as the apache or httpd or www users. As a simple test, try chmoding those two files to 0644 for owner rw-, group r--, and other r--. Assuming Apache has permission on the parent directory (which it sounds like it does), this should work. You should probably Google for "Linux file permissions tutorial" for more information.
 
Old 10-18-2005, 01:13 AM   #3
johnty01
LQ Newbie
 
Registered: Aug 2005
Location: vancouver, bc
Distribution: fc 4
Posts: 26

Original Poster
Rep: Reputation: 15
Thanks for the reply.

I tried that, and now the premissions are:

-rw-r--r-- 1 root root 115726863 Oct 16 15:55 file.zip

and the error i get is:
Quote:
You don't have permission to access /file.zip on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
what baffels me, is that the text file is in the SAME place, with the SAME permissions, and it shows up fine. Does that have something to do with the fact that its a zip file? or maybe the size limit? dunno... i have a little bit of experience running a server before, but this is just beyond my understanding.

Last edited by johnty01; 10-18-2005 at 01:14 AM.
 
Old 10-21-2005, 06:51 PM   #4
johnty01
LQ Newbie
 
Registered: Aug 2005
Location: vancouver, bc
Distribution: fc 4
Posts: 26

Original Poster
Rep: Reputation: 15
even more baffling:

-rwxr-xr-x 1 johnty root 121320431 Oct 2 12:01 file1.zip
-rwxr-xr-x 1 johnty root 115726863 Oct 16 15:55 file2.zip

file1 shows up, file 2 doesn't. any further suggestions?

*edit* i'm starting to think that the file is cursed... i made a copy of it, and it works... i still have NO idea why it didn't before.

Last edited by johnty01; 10-21-2005 at 07:24 PM.
 
Old 09-20-2006, 04:42 PM   #5
alela3
LQ Newbie
 
Registered: Oct 2003
Posts: 12

Rep: Reputation: 0
Quote:
Originally Posted by johnty01
even more baffling:

-rwxr-xr-x 1 johnty root 121320431 Oct 2 12:01 file1.zip
-rwxr-xr-x 1 johnty root 115726863 Oct 16 15:55 file2.zip

file1 shows up, file 2 doesn't. any further suggestions?

*edit* i'm starting to think that the file is cursed... i made a copy of it, and it works... i still have NO idea why it didn't before.
I am having the same exact problem with apache.
What I found is that by creating a file at the /var/www/html/ directory (vi /home/www/html/xxx.html) and then moving this file to my root directory, which is /home/httpd/ the file can be allowed.
But if instead I try: vi /home/httpd/xxx2.html this file will be forbidden when accessing via apache.
Anyone has solved this puzzle?
For your information the permissions are:


[root@s2 httpd]# ls -l xxx*
-rw-r--r-- 1 root root 5 Sep 20 18:40 xxx2.html
-rw-r--r-- 1 root root 5 Sep 20 18:35 xxx.html
The first file can be viewed and the second not.

Last edited by alela3; 09-20-2006 at 04:43 PM.
 
Old 04-05-2008, 02:20 PM   #6
spruceJuice
LQ Newbie
 
Registered: Apr 2008
Posts: 1

Rep: Reputation: 0
I'm new and had similar problems.




If you are accessing the file through a link then remember that all links are given with reference to the "DocumentRoot".

When I had trouble accessing certain files here's how I figured out the probs.

Go to the directory that is defined as "DocumentRoot" and remove any index.html file you have there to allow directory browsing. Move the file of interest to this folder, and visit your website to see if you are forbidden or not. If you're forbidden make sure you are giving sufficient file permission. If you have access to the files it probably means there's a problem with apache configuration or, in my case, you didn't write your links with reference to the "documentRoot" directory and apache couldn't find the files.

I found that images and music were automatically accessible by the apache user, but .txt and .pdf were not and I had to edit file permission. It may have been because the .pdf files were from a usb flash drive and the images and music were from the windows partition.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
apache 403 forbidden? wezhousheng Linux - Networking 5 05-13-2005 12:15 AM
apache error, 403 forbidden afrodocter Linux - Software 6 08-09-2004 08:35 PM
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 Forbidden quozt Linux - Networking 10 02-24-2004 04:59 PM


All times are GMT -5. The time now is 12:32 PM.

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