[KLUG Members] Have any of you successfully implemented .htaccess/.htpasswd functionality on your or your ISP servers?

Todd Pillars members@kalamazoolinux.org
Tue, 19 Nov 2002 14:17:41 -0500


Hi, I hope this helps

>From what I understand, .htaccess and .htpasswd are two ASCII files
>with no 'file' names ...

the (.) represents hidden files, not a delimiter for extensions.
in your home directory do a ls, and then a ls -la and you'll see.

>Depending on what one wants to do, these files will be located in
>various directories...

correct, only that you want the .htaccess in the protected directory and the
.htpasswd file outside your web tree. ie if your  web directory is
/home/someuser/www/html you want your .htpasswd file in the www directory
(or a dedicated directory for passwords such as
/home/someuser/www/passwords). remember that the password generated in
.htpasswd will have the permission of the creater, so you must either create
it as your httpd user or chown or chmod accordingly (chown someuser:apache
or chmod 744). ! you will have to have shell access to create the password
file using htpasswd the syntax is similar to

htpasswd -c /home/someuser/www/passwd/.htpasswd someuser (you can also pass
the password with the -b switch, but this allows the readline to grab a hold
of it.

also you have a specific directive in httpd.conf, the default in apache is:

<Directory "/home/someuser/www/html/protected">

    Options Indexes FollowSymLinks
    AllowOverride None  // <- Here you want to set to the desired override
ie "AuthConfig"
    Order allow,deny
    Allow from all      // <- Here you can set specific ip's or hosts to
connect

</Directory>

for a more detailed description for this go to
http://httpd.apache.org/docs/mod/core.html#allowoverride

>Here is the contents of .htaccess that the Apache Server will read and
>execute according to the its contents:

>AuthUserFile /www/htdocs/domains/xyz.com/webdocs/.htpasswd
>AuthGroupFile /dev/null
>AuthName "PD Documents"
>AuthType Basic

>require user rob"

your .htaccess file is basically correct

AuthType Basic
AuthName "By Invitation Only"
AuthUserFile /home/someuser/www/passwd/.htpasswd
Require user someuser

So basically you do have to have shell access and at least access to the
httpd.conf. Good luck

Todd