LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 01-20-2006, 11:46 PM   #1
Jake_B
LQ Newbie
 
Registered: Mar 2004
Distribution: RHEL
Posts: 27

Rep: Reputation: 15
Problem with htaccess?


I would like to use basic authentication to prevent people from accessing certain directories. I've used this:
Code:
AuthUserFile /var/www/.htpasswd
AuthGroupFile /dev/null
AuthName "Auth Required"
AuthType Basic

<Limit GET POST>
require valid-user
</Limit>
But, it has no effect, not so much as a log-in pop-up. Why?

Also, in httpd.conf, AllowOverride is set to "All".

Htaccess is chmod 644, this is a dir listing:
Code:
[root@localhost akair]# ls -Al
total 12
-rw-r--r--    1 akair akair      142 Jan 20 18:52 .htaccess
drwxr-xr-x    2 akair akair      4096 Jan 20 00:12 images
-rw-r--r--    1 akair akair      3635 Jan 20 00:12 working.php
There must be something in httpd.conf I'm missing???
 
Old 01-21-2006, 02:07 PM   #2
Jake_B
LQ Newbie
 
Registered: Mar 2004
Distribution: RHEL
Posts: 27

Original Poster
Rep: Reputation: 15
Anything, anyone?
 
Old 01-21-2006, 02:36 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
I'm assuming you're using the Apache 2.0.x series...

There's a tutorial on htaccess stuff at http://httpd.apache.org/docs/2.0/howto/htaccess.html which may be helpful. They recommend not using htaccess files unless you have to.

If you have access to edit the Apache httpd.conf file, have a look at http://httpd.apache.org/docs/2.0/howto/auth.html.
 
Old 01-21-2006, 02:48 PM   #4
Jake_B
LQ Newbie
 
Registered: Mar 2004
Distribution: RHEL
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by gilead
I'm assuming you're using the Apache 2.0.x series...

There's a tutorial on htaccess stuff at http://httpd.apache.org/docs/2.0/howto/htaccess.html which may be helpful. They recommend not using htaccess files unless you have to.

If you have access to edit the Apache httpd.conf file, have a look at http://httpd.apache.org/docs/2.0/howto/auth.html.
Yes, Apache 2.0.

Sorry, I've already read several tutorials on the issue, both at Apache.org and elsewhere. That's why I'm asking for advice here:

Httpd.conf seems to be properly configured (if you think otherwise, do you have a suggestion?) with AllowOverride iset to "All", and the .htaccess file seems to be properly formed with all the right directives (if you think otherwise, do you have a suggestion?). That's why I'm asking here, I've already read the tutorials...

Thanks...

Last edited by Jake_B; 01-21-2006 at 02:50 PM.
 
Old 01-21-2006, 03:04 PM   #5
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
I don't use htaccess files, I set up access from httpd.conf. The following works fine on my setup:

Code:
<Directory "/some/dir/webpics">
    Options Indexes FollowSymLinks
    IndexOptions FancyIndexing FoldersFirst IgnoreCase VersionSort NameWidth=*
    AllowOverride None
    Order allow,deny
    Allow from all
    AuthType Basic
    AuthName "Restricted Files"
    AuthUserFile /usr/local/apache2/passwd/passwords
    Require user webpics
</Directory>
I created the passwd file with:

Code:
/usr/local/apache2/bin/htpasswd -c /usr/local/apache2/passwd/passwords webpics
 
Old 01-21-2006, 03:48 PM   #6
Jake_B
LQ Newbie
 
Registered: Mar 2004
Distribution: RHEL
Posts: 27

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by gilead
I don't use htaccess files, I set up access from httpd.conf.
Hmmm... That's an idea. Now this question:

Looks like about the same directives I would put in the .htaccess file (which would make sense, but of course I'll read the docs...), so doing it your way, that is moving everything into the httpd.conf file, this eliminates the need for any .htaccess file?
 
Old 01-21-2006, 03:53 PM   #7
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Yep - I put the Directory section in the previous post in one of my virtual hosts and I don't have htaccess files anywhere. The 'AllowOverride None' directive stops any directives in .htaccess files from being used anyway.
 
  


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 problem .htaccess fipeso Linux - Networking 2 05-12-2005 11:56 PM
Strange htaccess problem (it ignored!) belorion Linux - Software 2 03-01-2005 02:32 PM
.htaccess problem lothario Linux - Software 0 01-22-2005 05:20 AM
.htaccess problem Ramon_E Linux - Security 3 10-20-2003 07:32 PM
.htaccess problem mwmethe Linux - Security 1 08-31-2002 12:32 PM

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

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