[ previous ]
[ Abstract ]
[ Copyright Notice ]
[ Contents ]
[ next ]
libnss-pgsql - Name Service Switch module for use with PostgreSQL
Chapter 2 Module and Database Setup
To use this module with a database you will need at least three tables in that
database. One for account data (the information usually stored in
/etc/passwd
), one for group data (/etc/group
) and
another one storing information about groupmembership (there is a m:n relation
between passwd and group so you need this weak entity). If you have an
existing database you do not want to modify you can use views or table
expressions (see Confile File, Section A.2),
of course.
There have to be some required fields in those tables. They are described
below.
passwd table (see getpwnam(3)
for more information)
-
login name
-
password
-
numerical user id (uid)
-
numerical primary group id (gid)
-
login shell
-
description (gecos)
-
home directory
group table (see getgrnam(3)
)
-
group name
-
group password
-
numerical group id (gid)
An example database schema can be found in Database Schema, Section A.1. See there for how
to construct the groupmember table.
Having a working database, you must write your configfile
/etc/nss-pgsql.conf
. This file has a simple syntax:
LINE := COMMENT | EMPTY | STATEMENT
COMMENT := '#' <text>
EMPTY := ''
STATEMENT := KEYWORD '=' <value>
With KEYWORD being one of the following (all are required):
- host
-
Hostname or IP address of PostgreSQL server.
- port
-
Port on which the Postmaster listens.
- database
-
The database name.
- login
-
Username for logging in to the PostgreSQL server.
- passwd
-
Password for logging in.
- passwdtable
-
Name of the table storing the account data.
- grouptable
-
Table storing group data.
- groupmembertable
-
Table storing the 'links' between account and group data.
- passwd_name
-
Name of field in passwdtable storing the user name.
- passwd_passwd
-
Field storing the password.
- passwd_uid
-
Field storing the numerical user id.
- passwd_dir
-
Field storing the $HOME directory.
- passwd_shell
-
Field storing the user's shell.
- passwd_gecos
-
Field storing additional information about this user, e.g. his full name and
phone number.
- passwd_gid
-
Field storing the numerical primary group id.
- group_name
-
Name of the field in grouptable storing the group name.
- group_passwd
-
Field storing the groups password.
- group_gid
-
Field storing the group id.
- group_member
-
Name of field in groupmembertable storing the user name being
member of the queried group.
[ previous ]
[ Abstract ]
[ Copyright Notice ]
[ Contents ]
[ next ]
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