[mythtv-users] mythweb mysql authentication
IvanK.
chepati at yahoo.com
Thu Oct 23 19:27:00 EDT 2003
Hey guys,
I just wanted to share a bit of information with you.
Since we're already running mysql, I thought it'd be convenient to use mysql
authentication for mythweb. So I created a database myth_users with one
table, users, with three fields, username, passwd and groups.
Then I created this .htaccess which I placed in the mythweb root dir:
=== BEGIN ===
AuthName "MythTV Area"
AuthType Basic
PerlAuthenHandler Apache::AuthDBI::authen
PerlAuthzHandler Apache::AuthDBI::authz
PerlSetVar Auth_DBI_data_source
DBI:mysql:database=myth_users;host=localhost;mysql_socket=/tmp/mysql.sock
PerlSetVar Auth_DBI_username mythtv
PerlSetVar Auth_DBI_password mythtv
PerlSetVar Auth_DBI_pwd_table users
PerlSetVar Auth_DBI_uid_field username
PerlSetVar Auth_DBI_pwd_field passwd
PerlSetVar Auth_DBI_grp_field groups
PerlSetVar Auth_DBI_encrypted off
require group MythTV Admin
=== END ===
NOTE: chmod 400 .htaccess!!!!!!!
You need Apache-DBI. In my example, mysql and mythweb are on the same box,
but they very well could be on completely separate machines. In this case,
change the line
DBI:mysql:database=myth_users;host=localhost;mysql_socket=/tmp/mysql.sock
to something like
DBI:mysql:database=myth_users;host=192.168.0.1;mysql_port=3306
(assuming mysql is running on port 3306 of 192.168.0.1)
on 192.168.0.1 you'll need to run this in mysql:
GRANT ALL ON mythconverg.* TO user at host IDENTIFIED BY 'mythtv';
FLUSH PRIVILEGES
user at host is the username @ the hostname of the mythweb machibe. The username
should be the user that runs apache (User <username> in httpd.conf). So if
you run mythweb as the user mythweb on 192.168.0.2, then do (on 192.168.0.1):
GRANT ALL ON mythconverg.* TO mythweb at 192.168.0.2 IDENTIFIED BY 'mythtv';
FLUSH PRIVILEGES
make sure to have a line that says
AllowOverride AuthConfig
in httpd.conf for the mythweb root directory. Then create at least one record
in myth_users.users with group=MythTV or Admin. Of course you can use
different group names, but make sure to use them consistently throughout
.htaccess and in the mysql table.
That's it. Hope this helps people. If I've made a mistake in the above
instructions, please correct me.
IvanK.
More information about the mythtv-users
mailing list