if you just want a password protected directory, why not just use htpasswd?

You would first set up a password file:

htpasswd -c /path/to/password_file myuser

Enter the passwords. These are encrypted and stored in the specified file. (NOTE: the -c means to create, so only use -c for the first user).

Any user can enter this command (sans the -c parameter), as long as they can write to the password file. The password file should be readable by the web service account too. So, you can control who can modify the file with simple file permissions.

Next, you modify your Apache config a little to indicate it should be using passwords. I add the following to my vhosts files:

<Directory /path/to/my/secure/folder>
    AuthType Basic
    AuthName "My Authentication Realm"
    ## Modify the path to match that used in the htpasswd command
    AuthUserFile /home/svn/project1/.htpasswd
    Require valid-user
</Directory>

The AuthType and related directives can be placed at server, vhost, directory, and or Location levels.

Once that is done, reload the apache config with
  /etc/init.d/apache2 reload  (or similar depending on distro)

And you are done. Accessing the server/vhost/directory/location will now require a password.

I tend to prefer this method because it is part of Apache and requires no extra processes (like Perl). It is simple, and flexible. If you want htdigest authentication instead, it's only a slight change. With a little tweaking and understanding of the Apache config directives (and/or modules), you can even authenticate against Active Directory servers with a similar set up (though that IS a little more complex).

Anyways, glad you got your problem beat.  Perhaps this is an alternative.

Shawn


Gustin Johnson wrote:
<snip>
perhaps there is another solution to this problem.  What I am attempting
to do, is to create a secure section of the web site (password
required)  If anyone can suggest another non-perl program that will
allow an authorized person to add or remove users, and allow the user to
retrieve / change their information as needed, let me know about it and
I will give it a try.

_______________________________________________
clug-talk mailing list
[email protected]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca
Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
**Please remove these lines when replying

Reply via email to