[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: authentication in apache for a subdirectory



Ankush Grover wrote:
Hey,

  I want to configure authentication for a particular directory and
subdirectories below that directory.

I have written these entries in httpd.conf ,but authentication is not working.

<Directory  /var/www/html/open/hms/modules>
  AllowOverride   AuthConfig

Probably not what you want - this allows overrides in .htaccess files - you're specifying your authentication directly. Shouldn't hurt though.


  AuthType   Basic
  AuthName  "Access to the Modules"
  AuthUserFile   /opt/htpasswd/passwd.users
  Require        valid-user
   </Directory>

The only thing we add to our configs are the access permission directives, but I don't know if these are mandatory. Did you make sure that your httpd server was restarted after making the changes? They won't have any effect otherwise.


I'll give you an example of a config we use here which definitely works. Rather than appending this to httpd.conf it's probably better to put each one in a separate file in /etc/httpd/conf.d as that tends to be easier to maintain. Remember that you MUST restart (or reload) httpd after making these changes for them to have any effect.


<Directory /data/whatever> AllowOverride None Options None Order allow,deny Allow from all Require valid-user AuthType Basic AuthName "Protected Area" AuthUserFile /data/whatever/.htpasswd </Directory>

Hope this helps

Simon.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]