Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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...
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.
-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.
-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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.