...

View Full Version : best way to Authentication



jedimastermopar
11-30-2006, 03:54 PM
Well, I have a website I want to allow un authenticated access to. Then I have several directories of html and php files that I want to password protect. What is the best way to do this? I can do it with .htaccess but I don't think anyone likes to use that anymore? Is there an easyish way to setup a small db to store usernames, password and group and then set the directories to allow groups in? I would need to be able to have people belong to multiple groups as some people will have access to more than one authenticated directory.

jedimastermopar
11-30-2006, 04:00 PM
I read this file but I am unsure of the <directory> part and how you assign a group to a particular directory. Has anyone used this method of securing a website?
also I am not sure where you type in the <directory> part is that a set of commands to be run in mysql? or is that a file you put in the directory or what?

# CREATE DATABASE auth;
# USE auth;
# CREATE TABLE users (
# user_name CHAR(30) NOT NULL,
# user_passwd CHAR(20) NOT NULL,
# PRIMARY KEY (user_name)
# );
# CREATE TABLE groups (
# user_name CHAR(30) NOT NULL,
# user_group CHAR(20) NOT NULL,
# PRIMARY KEY (user_name, user_group)
# );
# GRANT SELECT
# ON auth.users
# TO authuser@localhost
# IDENTIFIED BY 'PaSsW0Rd';
# GRANT SELECT
# ON auth.groups
# TO authuser@localhost
# IDENTIFIED BY 'PaSsW0Rd';
#
# INSERT INTO users VALUES ('testuser', ENCRYPT('testpass'));
# INSERT INTO groups VALUES ('testuser', 'user');
# INSERT INTO users VALUES ('testadmin', ENCRYPT('testpass'));
# INSERT INTO groups VALUES ('testadmin', 'admin');
# INSERT INTO groups VALUES ('testadmin', 'user');
#
#<Directory /var/www>
# AuthName "MySQL group authenticated zone"
# AuthType Basic
#
# AuthMySQLEnable on
# AuthMySQLUser authuser
# AuthMySQLPassword PaSsW0Rd
# AuthMySQLDB auth
# AuthMySQLUserTable users
# AuthMySQLNameField user_name
# AuthMySQLPasswordField user_passwd
# AuthMySQLGroupTable groups
# AuthMySQLGroupField user_group
#
# require group user
#</Directory>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum