You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John D <ja...@gmail.com> on 2012/03/01 20:48:38 UTC

[users@httpd] public_html directory authentication

I'm running Apache/2.2.3 on a centos 5 server and trying to setup
authentication for a subdirectory in a user's public_html folder.
I created a .htaccess file and .htpasswd file in that subdirectory  with
permissions 0644. But now the subdirectory does not show up
on the web page. In my httpd.conf file I have:

 <Directory /home/*/public_html>
   AllowOverride AuthConfig
 </Directory>

I've also tried adding this to the httpd conf file
 <Directory /home/username/public_html/Private>
    AuthType Basic
    AuthUserFile  /home/username/public_html/Private/.htpasswd
    AuthName Test
    Require valid-user
</Directory>


but that also doesn't seem to work. The only thing that works a bit for me
is to set AllowOverride to None in the /home/*/public_html directory config
but that just enables the folder to show and does no authentication. Can
anyone help me?

Thanks

Re: [users@httpd] public_html directory authentication

Posted by Anam Ali Khan <an...@yahoo.com>.
Hello,

Try with this configuration:

 <Directory /home/username/public_html/Private>
    AuthType Basic
    AuthUserFile  /home/username/public_html/Private/.htpasswd
    AuthName Test
    Require valid-user
    AllowOverride All
    Order allow,deny
    Allow from all

</Directory>

chmod 644 /home/username/public_html/Private/.htpasswd
chown root:apache /home/username/public_html/Private/.htpasswd

Note: You dont need to store password file in a publicly accessible directory, i think it can be a security risk.

-Anam



________________________________
 From: John D <ja...@gmail.com>
To: users@httpd.apache.org 
Sent: Friday, 2 March 2012, 0:48
Subject: [users@httpd] public_html directory authentication
 

I'm running Apache/2.2.3 on a centos 5 server and trying to setup authentication for a subdirectory in a user's public_html folder.
I created a .htaccess file and .htpasswd file in that subdirectory  with permissions 0644. But now the subdirectory does not show up 
on the web page. In my httpd.conf file I have:

 <Directory /home/*/public_html>
   AllowOverride AuthConfig
 </Directory>

I've also tried adding this to the httpd conf file
 <Directory /home/username/public_html/Private>
    AuthType Basic
    AuthUserFile  /home/username/public_html/Private/.htpasswd
    AuthName Test
    Require valid-user
</Directory>


but that also doesn't seem to work. The only thing that works a bit for me is to set AllowOverride to None in the /home/*/public_html directory config but that just enables the folder to show and does no authentication. Can anyone help me?

Thanks