mypasswd/mygroup v2.0
=====================

This are two little tools which allow to add, change and delete user
records storing group or password entries in MySQL tables.

These two programs are based on the mypasswd v1.0 program by Harry Brueckner 
(brueckner@respublica.de). 
I split his mypasswd program in two programs three reasons
* to be able to remember the command line options ;-)
* to be able to use separate tables for password authentication
  and group membership (just as mod_auth_mysql does)
* to be able to delete users from the password/group tables

By default, the passwords are encrypted with crypt() for use with the
mod_auth_mysql module for the Apache WWW server. But there is a command
line switch to use the mySQL password() routine. So, these programs can
be used on the mySQL user database mysql too.

(Just to mention it: with a small patch to mod_auth_mysql, [and an
additional table for groups,] the mysql user database can be used for
authenticating the users that access mySQL via the Apache Server too.
I will mail these patches to Zeev Suraski the current maintainer of
mod_auth_mysql.  Look out on the net, if you are interested in it.)


Installation:
-------------

To compile and install the program perform the following steps:
   1. Edit the paths for the include and lib files in the Makefile
   2. Run "make dep" to create the dependencies
   3. Run "make" to create the binaries
   4. Run "make install" to install the binaries


Syntax:
-------

  The Syntax for mypasswd is:

  mypasswd [<options>] <database> <password table> <user field> <password field> <user> [<password>]
  where <options> are:
    -H  --host <host>          connect to host <host> (default: localhost)
    -U  --auth-userhost <user> connect to the database as <user>
    -P  --auth-password <pw>   connect to the database with password <pw>
    -s  --scramble             use mySQL password() function for passwords
    -c  --crypt                use crypt() function for passwords (default)
    -d  --delete               delete user
    -v  --verbose              display what happens / show the SLQ queries
    -q  --quiet                silent operation (no error messages)
    -h  --help                 show this help page
    -V  --version              display version number

  The Syntax for mygroup is:

  mygroup [<options>] <database> <group table> <user field> <group field> <user> [<group>]
  where <options> are:
    -H  --host <host>          connect to host <host> (default: localhost)
    -U  --auth-userhost <user> connect to the database as <user>
    -P  --auth-password <pw>   connect to the database with password <pw>
    -d  --delete               delete user (from group)
    -v  --verbose              display what happens / show the SLQ queries
    -q  --quiet                silent operation (no error messages)
    -h  --help                 show this help page
    -V  --version              display version number


Example:
--------

  Let the database MyDB consist of two tables that looks like

  Table: Passwd
  +----------+----------+------+-----+---------+-------+
  | Field    | Type     | Null | Key | Default | Extra |
  +----------+----------+------+-----+---------+-------+
  | User     | char(25) |      | PRI |         |       |
  | Password | char(25) |      |     |         |       |
  +----------+----------+------+-----+---------+-------+

  Table: Groups
  +----------+----------+------+-----+---------+-------+
  | Field    | Type     | Null | Key | Default | Extra |
  +----------+----------+------+-----+---------+-------+
  | User     | char(25) |      | PRI |         |       |
  | Group    | char(25) |      |     |         |       |
  +----------+----------+------+-----+---------+-------+

  To add the user HARRY with password 'secret' (or to change
  HARRY's password to 'secret' if ia record for HARRY already
  is in the Passwd table), the call to mypasswd would be:
  
    mypasswd MyDB Passwd User Password HARRY secret
  
  If the password is not given on the command line, it will be
  asked interactively using the getpass() function.

  To delete the user HARRY from the Password table, the call
  to mysql would be:

    mypasswd -d MyDB Passwd User Password HARRY secret

  To add HARRY to the group 'admins', the call to mygroup would
  be:

    mygroup MyDB Groups User Group HARRY admins

  To delete HARRY from the group 'admins', the call to mygroup
  would be:

    mygroup -d MyDB Groups User Group HARRY admins

  To delete HARRY from all groups, the call to mygroup would be:

    mygroup -d MyDB Groups User Group HARRY


Disclaimer:
-----------

  mypasswd/mygroup 2.0 come with no warranty of any kind whatsoever.
  WYGIWYPF (What you get is what you pay for) !


Credits:
--------

  Thanks to
  * TCX for their great database.
    If you use it commercially, plese register !!!
  * Zeev Suraski (bourbon@netvision.net.il), the current maintainer
    of mod_auth_mysql (is he ?)
  * Harry Brueckner (brueckner@respublica.de) for his program.

--

Peter Marschall
peter.marschall@gedos.de

