2 # Minimalist sample libnss-mysql database
4 # $Id: sample_database.sql,v 1.2 2004/07/21 17:54:15 cinergi Exp $
6 # sample_database.sql revision compatible libnss-mysql versions
7 # -------------------------------------------------------------------
10 # Use 'mysql -u root -p < sample_database.sql' to load this example into MySQL
12 # This particular example stores as little as possible in the MySQL database.
13 # The 'users' table only has username/uid/password in it. The rest is
14 # 'hard coded' via the configuration files.
15 # The groups database remains unchanged from the main sample as it is
16 # already pretty minimal. If you do not require MySQL group support,
17 # simply delete the 'groups' and 'grouplist' tables and do not configure
18 # /etc/nsswitch.conf with 'mysql' on the 'group' line
20 # This configuration suits something like an ISP where all users may have
21 # the same gid, home directory base, shell, etc. You can really do
22 # some funky things inside the configuration files if you wanted to, such
23 # as define a different shell depending on the uid returned; that just
24 # takes a bit of SQL query magic...
31 name varchar(16) NOT NULL default '',
32 password varchar(34) NOT NULL default 'x',
33 gid int(11) NOT NULL auto_increment,
35 ) TYPE=MyISAM AUTO_INCREMENT=5000;
37 CREATE TABLE grouplist (
38 rowid int(11) NOT NULL auto_increment,
39 gid int(11) NOT NULL default '0',
40 username char(16) NOT NULL default '',
45 username varchar(16) NOT NULL default '',
46 uid int(11) NOT NULL auto_increment,
47 password varchar(34) NOT NULL default 'x',
49 UNIQUE KEY username (username),
51 ) TYPE=MyISAM AUTO_INCREMENT=5000;
54 INSERT INTO users (username,password) VALUES ('cinergi', ENCRYPT('cinergi'));
55 INSERT INTO groups (name) VALUES ('foobaz');
56 INSERT INTO grouplist (gid,username) VALUES (5000,'cinergi');
59 GRANT USAGE ON *.* TO `nss-root`@`localhost` IDENTIFIED BY 'rootpass';
60 GRANT USAGE ON *.* TO `nss-user`@`localhost` IDENTIFIED BY 'userpass';
62 GRANT Select (`username`, `uid`, `password`)
64 TO 'nss-root'@'localhost';
65 GRANT Select (`name`, `password`, `gid`)
67 TO 'nss-root'@'localhost';
69 GRANT Select (`username`, `uid`)
71 TO 'nss-user'@'localhost';
72 GRANT Select (`name`, `password`, `gid`)
74 TO 'nss-user'@'localhost';
76 GRANT Select (`username`, `gid`)
78 TO 'nss-user'@'localhost';
79 GRANT Select (`username`, `gid`)
81 TO 'nss-root'@'localhost';