Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client denied by server configuration

Status
Not open for further replies.

ITadvice

IS-IT--Management
Jul 22, 2008
38
US
I have a web page that has two links to text files. When I click on the links I get an access denied message (error 403). In the log file it says the client is denied by the server configuration. For some reason the folder with the text files is the only folder I am having trouble accessing. The server is setup so that I can access the subfolders. I have even tried changing the file permissions and user groups. Any suggestions?

 
It would seem that the server is configured to not allow browsing of the directory structure. When a specific file is not named in the url or the url ends in a backslash, that could give you the error you are seeing. Remember that linux is case sensitive. So if you are used to Windows not giving a hoot, this is a common mistake. If this site is setup on a server hosted by a provider, then chances are, we are looking for a typo in the url or the filenames themselves.
 
One other thing that I have run into is that the permissions on the file that you are attempting to view need to be set correctly. These files need to be read-able by 'others'.

 
RhythmAce,
How do I configure the server to allow directory browsing?

Noway2,
I tried changing the file permissions but I still can't access the page.

Note- When I used Internet Explorer it suggests that a likely cause is the that the site requires you to login. A login is required on the home page but its only the text file links that are giving me trouble. What could be the cause of this?


 
Actually, you don't want people to be able to see your directory structure. You can use directives such as FancyIndexing but that lets people who enter a url where the specified file doesn't exist, to see the contents of your directories. Usually, you would want to put an index such as index.html in all your directories to prevent this. You can put anything you want in these files. The idea is to give them the message that you don't want them fooling around where they don't belong. Getting back to your problem, dumb question but what is the extension of the text files. It could be causing mime issues? For example, if you are using an extension that is not covered by the mimetypes, you will need to use the AddType to tell apache to parse the file as a text/html file or just rename it.
 
Do you have any .htaccess files in that directory or any directories above it? Is that directory actually under your document root, or is it somewhere else?
 
RhytmAce has a good point about not letting others root around in your directories.

If you do want to have the directories browsable, for example I leave my SVN repository section browsable for my own convenience, you will want to ensure that it is effectively jailed so that other areas are inaccesible.
 
What happens if you right click on the links - does it let you save the files to your computer? If so it's probably the file type/handler information that RhythmAce mentions above, because if you can access the file to save it on your computer it's not an access problem.
 
donb01,
When I right click and try to save I get an error message "Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found." So I guess that means it is an access problem..


More Background info..

My web page generates two log files. I have links to the files but I cant view the pages. The files are in .txt format. All of the files and folders are under the document root directory. These are the only files that I have trouble accessing. I don't want to make the directory accessible, I just want to display the text files in the browser.

Some weeks ago, as a security measure, the server was configured to require a username and password to access the site. I was recently told that the web page does not display the text files. I was not involved in the configuring so I'm not sure how it has affected the program.
 
Ohhhhhhhh.....

Are these the Apache log files we're talking about here?? Where there is one that shows all the page traffic and who's accessing the site, etc, and the other shows all the site error messages???

If that is the case you may not be able to access those files because they are open and locked for writing by Apache. If they are some other log files just ignore me and go on your way... :eek:)

I'm used to the linux world for all this stuff and have to try and shift my thinking into Windows, and the first thing that pops into my mind is the files are open by another application and therefore not accessible to you.

My guess in this case would be that you need to somehow open the files in read-only access, and I don't know if you can do that with a link, and even if you can, if they are exclusively locked it may not matter....

Another possibility if it lets you get around the lock situation is if you can create a script that runs on a timer that simply copies the 2 files out to a new filename every so often. That way the new files should not be locked and may be accessible to you.

This is just the direction my mind went - it may not be the right direction, but it sounded good while I was thinking it!
 
In most cases, the directory permissions are set to 755 and the web pages are set to 644. Remember that apache is a user and needs access to these directories too. It at least needs to be able to read the files. To restrict access, you would use the Order allow, deny directive or some type of authentication. But first you need apache to be able to get to those files.
 
This is so confusing! When I originally set this up everything worked fine. I had no problem displaying the text files in the browser. Apache has access to a directory; the files are in a subfolder two levels below this directory. Here is my configuration:

<Directory "/top/level/directory/">
Options Indexes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order Deny, Allow
Deny from all
allow from (IP address range)

The folder's permissions are set to drwxrw-rw- (766). The files are set to 766 with nobody and nogroup as the users (I changed them to root and root but it didn't make a difference).
 
depending on what flavor and age of OS is being used you can also try apache.apache and see if that works. I believe somewhere close to the beginning of your httpd.conf file (if there is one in your config) you will find the variable that names the apache user name. I have seen nobody and apache so far, but presumably it could be anything.

although the way you wrote it should work, the other thing to try is to make a Directory entry right to ground zero, like:

<Directory "/top/level/directory/sub1/sub2/">

Start with allow, deny and allow from all for testing, and then change it as needed once you know it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top