[ previous ] [ Abstract ] [ Copyright Notice ] [ Contents ]

libnss-pgsql - Name Service Switch module for use with PostgreSQL
Appendix A Examples


A.1 Database Schema

     CREATE TABLE "groups" (
             "gid" serial NOT NULL,
             "name" character varying(16) NOT NULL,
             "passwd" character varying(20),
             PRIMARY KEY ("gid")
     );
     
     CREATE TABLE "accounts" (
             "uid" serial NOT NULL,
             "login" character varying(8) NOT NULL,
             "passwd" character varying(30) NOT NULL,
             "shell" character varying DEFAULT '/bin/bash' NOT NULL,
             "homedir" character varying NOT NULL,
             PRIMARY KEY ("login")
     );
     
     CREATE TABLE "usergroups" (
             "gid" int4 NOT NULL,
             "uid" int4 NOT NULL,
             PRIMARY KEY ("gid", "uid"),
             CONSTRAINT "ug_gid_fkey" FOREIGN KEY ("gid")
                 REFERENCES "groups"("gid"),
             CONSTRAINT "ug_uid_fkey" FOREIGN KEY ("uid")
                 REFERENCES "accounts"("uid")
     );


A.2 Confile File

     # database parameters
     host            = 127.0.0.1
     port            = 5432
     database        = benutzer
     login           = postgres
     passwd          = foo
     
     # the tables used (or tableexpressions!)
     passwdtable     = accounts
     grouptable      = groups
     # the next line is wrapped for readability though 
     # this is not legal in a config file
     groupmembertable = accounts JOIN usergroups ON
          accounts.uid=usergroups.uid JOIN groups ON
          usergroups.gid=groups.gid
     
     # fields used in passwd functions
     passwd_name     = login
     passwd_passwd   = passwd
     passwd_uid      = uid
     passwd_dir      = homedir
     passwd_shell    = shell
     passwd_gecos    = login
     passwd_gid      = uid
     
     # fields used in group functions
     group_name      = name
     group_passwd    = passwd
     group_gid       = gid
     group_member    = login


[ previous ] [ Abstract ] [ Copyright Notice ] [ Contents ]
libnss-pgsql - Name Service Switch module for use with PostgreSQL
1.0.0
Jörg Wendland jorgland@sol.wohnheim.uni-ulm.de
Bret Mogilefsky mogul@gelatinous.com