Imported Upstream version 0.63.0
[hcoop/debian/courier-authlib.git] / userdb / makeuserdb.8.in
CommitLineData
8d138742 1.\" <!-- $Id: makeuserdb.sgml,v 1.8 2008/07/13 21:58:26 mrsam Exp $ -->
d9898ee8 2.\" <!-- Copyright 1998 - 2007 Double Precision, Inc. See COPYING for -->
3.\" <!-- distribution information. -->
4.\" Title: makeuserdb
5.\" Author:
8d138742
CE
6.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
7.\" Date: 08/23/2008
d9898ee8 8.\" Manual: Double Precision, Inc.
9.\" Source: Double Precision, Inc.
10.\"
8d138742 11.TH "MAKEUSERDB" "8" "08/23/2008" "Double Precision, Inc." "Double Precision, Inc."
d9898ee8 12.\" disable hyphenation
13.nh
14.\" disable justification (adjust text to left margin only)
15.ad l
16.SH "NAME"
8d138742 17makeuserdb - create @userdb@
d9898ee8 18.SH "SYNOPSIS"
19.HP 11
20\fBmakeuserdb\fR [\-f\ \fIfilename\fR]
21.HP 10
22\fBpw2userdb\fR
23.HP 14
24\fBvchkpw2userdb\fR [\-\-vpopmailhome=\fIdir\fR] [\-\-todir=\fIdir\fR]
25.SH "DESCRIPTION"
26.PP
27
28\fBmakeuserdb\fR
29creates
8d138742 30\fI@userdb@\.dat\fR
d9898ee8 31from the contents of
8d138742
CE
32\fI@userdb@\fR\.
33\fI@userdb@\fR\'s contents are described later in this document\.
d9898ee8 34Maildrop,
35Courier, and other applications use
8d138742
CE
36\fI@userdb@\.dat\fR
37as a substitute/complement for your system password file\. The usual purpose for
38\fI@userdb@\.dat\fR
39is to specify "virtual" accounts \- accounts that do not have an associated system login\. Usually (but not necessarily) all virtual accounts share the same system userid\.
40\fI@userdb@\.dat\fR
41may also replace your system password file\. Because the system password file is a text file, when there\'s a large number of accounts it will be significantly faster to search
42\fI@userdb\.dat@\fR, which is a binary database, instead of a flat text file that the system password file usually is\.
d9898ee8 43.PP
44The
45\fBmakeuserdb\fR
8d138742 46command can be safely executed during normal system activity\.
d9898ee8 47.PP
48The
49\fB\-f\fR
50option creates
8d138742 51\fI\fIfilename\fR\fR\fI\.dat\fR
d9898ee8 52from
53\fI\fIfilename\fR\fR, instead of the default
8d138742 54\fI@userdb@\.dat\fR
d9898ee8 55from
8d138742 56\fI@userdb@\fR\.
d9898ee8 57.SS "Format of \fI@userdb@\fR"
58.PP
59
60\fI@userdb@\fR
8d138742 61is a plain text file that can be created using any text editor\. Blank lines are ignored\. Lines that start with the # character are comments, and are also ignored\. Other lines define properties of a single "account", one line per account\.
d9898ee8 62\fI@userdb@\fR
8d138742 63may be a directory instead of a plain file\. In that case all files in
d9898ee8 64\fI@userdb@\fR
8d138742 65are essentially concatenated, and are treated as a single file\. Each line takes the following format:
d9898ee8 66.sp
67.RS 4
68.nf
8d138742 69\fIname\fR<TAB>\fIfield\fR=\fIvalue\fR|\fIfield\fR=\fIvalue\fR\.\.\.
d9898ee8 70.fi
71.RE
72.PP
73\fIname\fR
8d138742 74is the account name\.
d9898ee8 75\fIname\fR
76MUST contain only lowercase characters If
77Courier
78is configured to treat lowercase and uppercase account names as identical,
79\fIname\fR
8d138742 80is followed by exactly one tab character, then a list of field/value pairs separated by vertical slashes\.
d9898ee8 81\fIfield\fR
82is the name of the field,
83\fIvalue\fR
8d138742
CE
84is the field value\. Fields and values themself cannot contain slashes or control characters\. Fields may be specified in any order\. Here are all the currently defined fields\. Note that not every field is used by every application that reads
85\fI@userdb@\.dat\fR\.
d9898ee8 86.PP
87
88\fIuid\fR
89\-
90\fIvalue\fR
8d138742 91is a (possibly) unique numerical user ID for this account\.
d9898ee8 92.PP
93
94\fIgid\fR
95\-
96\fIvalue\fR
8d138742 97is a (possibly) unique numerical group ID for this account\.
d9898ee8 98.PP
99
100\fIhome\fR
101\-
102\fIvalue\fR
8d138742 103is the account\'s home directory\.
d9898ee8 104.PP
105
106\fIshell\fR
107\-
108\fIvalue\fR
8d138742 109is the account\'s default login shell\.
d9898ee8 110.PP
111
112\fIsystempw\fR
113\-
114\fIvalue\fR
8d138742 115is the account\'s password\. See
d9898ee8 116\fI\fBuserdbpw\fR(8)\fR\&[1]
8d138742 117for details on how to set up this field\.
d9898ee8 118.PP
119
8d138742 120\fIpop3pw, esmtppw, imappw\.\.\.\fR
d9898ee8 121\-
122\fIvalue\fR
8d138742 123specifies a separate password used only for authenticating access using a specific service, such as POP3, IMAP, or anything else\. If not defined,
d9898ee8 124\fIsystempw\fR
8d138742 125is always used\. This allows access to an account to be restricted only to certain services, such as POP3, even if other services are also enabled on the server\.
d9898ee8 126.PP
127
128\fImail\fR
129\-
130\fIvalue\fR
8d138742 131specifies the location of the account\'s Maildir mailbox\. This is an optional field that is normally used when
d9898ee8 132\fBuserdb\fR
8d138742 133is used to provide aliases for other mail accounts\. For example, one particular multi\-domain E\-mail service configuration that\'s used by both
d9898ee8 134Qmail
135and
136Courier
8d138742 137servers is to deliver mail for a mailbox in a virtual domain, such as "user@example\.com", to a local mailbox called "example\-user"\. Instead of requiring the E\-mail account holder to log in as "example\-user" to download mail from this account, a
d9898ee8 138\fBuserdb\fR
8d138742 139entry for "user@example\.com" is set up with
d9898ee8 140\fImail\fR
8d138742 141set to the location of example\-user\'s Maildir mailbox, thus hiding the internal mail configuration from the E\-mail account holder\'s view\.
d9898ee8 142.PP
143
144\fIquota\fR
145\-
146\fIvalue\fR
8d138742 147specifies the maildir quota for the account\'s Maildir\. This has nothing to do with actual filesystem quotas\.
d9898ee8 148Courier
8d138742 149has a software\-based Maildir quota enforcement mechanism which requires additional setup and configuration\. See
d9898ee8 150\fI\fBmaildirquota\fR(7)\fR\&[2]
8d138742
CE
151for additional information\.
152.SS "\fI@userdb@shadow\.dat\fR"
d9898ee8 153.PP
8d138742
CE
154All fields whose name ends with \'pw\' will NOT copied to
155\fI@userdb@\.dat\fR\. These fields will be copied to
156\fI@userdb@shadow\.dat\fR\.
d9898ee8 157\fBmakeuserdb\fR
158creates
8d138742
CE
159\fI@userdb@shadow\.dat\fR
160without any group and world permissions\. Note that
d9898ee8 161\fBmakeuserdb\fR
162reports an error if
163\fB@userdb@\fR
8d138742 164has any group or world permissions\.
d9898ee8 165.SS "CONVERTING \fI/etc/passwd\fR and vpopmail to \fI@userdb@\fR format"
166.PP
167
168\fBpw2userdb\fR
169reads the
170\fI/etc/passwd\fR
171and
172\fI/etc/shadow\fR
173files and converts all entries to the
174\fI@userdb@\fR
8d138742 175format, printing the result on standard output\. The output of
d9898ee8 176\fBpw2userdb\fR
177can be saved as
178\fB@userdb@\fR
8d138742 179(or as some file in this subdirectory)\. Linear searches of
d9898ee8 180\fI/etc/passwd\fR
8d138742 181can be very slow when you have tens of thousands of accounts\. Programs like
d9898ee8 182\fBmaildrop\fR
183always look in
184\fI@userdb@\fR
8d138742 185first\. By saving the system password file in
d9898ee8 186\fI@userdb@\fR
8d138742 187it is possible to significantly reduce the amount of time it takes to look up this information\.
d9898ee8 188.PP
189After saving the output of
190\fBpw2userdb\fR, you must still run
191\fBmakeuserdb\fR
192to create
8d138742 193\fI@userdb@\.dat\fR\.
d9898ee8 194.PP
195
196\fBvchkpw2userdb\fR
197converts a vpopmail\-style directory hierarchy to the
198\fI@userdb@\fR
8d138742 199format\. This is an external virtual domain management package that\'s often used with
d9898ee8 200Qmail
8d138742 201servers\.
d9898ee8 202.PP
8d138742 203Generally, an account named \'vpopmail\' is reserved for this purpose\. In that account the file
d9898ee8 204\fIusers/vpasswd\fR
205has the same layout as
206\fI/etc/passwd\fR, and performs a similar function, except that all userid in
207\fIusers/vpasswd\fR
8d138742 208have the same userid\. Additionally, the
d9898ee8 209\fIdomains\fR
8d138742
CE
210subdirectory stores virtual accounts for multiple domains\. For example,
211\fIdomains/example\.com/vpasswd\fR
d9898ee8 212has the passwd file for the domain
8d138742
CE
213\fIexample\.com\fR\. Some systems also have a soft link,
214\fIdomains/default\fR, that points to a domain that\'s considered a "default" domain\.
d9898ee8 215.PP
216The
217\fBvchkpw2userdb\fR
218reads all this information, and tries to convert it into the
219\fI@userdb@\fR
8d138742 220format\. The
d9898ee8 221\fI\-\-vpopmailhost\fR
8d138742 222option specifies the top level directory, if it is not the home directory of the vpopmail account\.
d9898ee8 223.PP
224The
225\fBvchkpw2userdb\fR
8d138742 226script prints the results on standard output\. If specified, the
d9898ee8 227\fI\-\-todir\fR
228option tries to convert all
229\fIvpasswd\fR
230files one at a time, saving each one individually in
8d138742 231\fIdir\fR\. For example:
d9898ee8 232.sp
233.RS 4
234.nf
235mkdir @userdb@
236vchkpw2userdb \-\-todir=@userdb@/vpopmail
237makeuserdb
238.fi
239.RE
240.PP
241It is still necessary to run
242\fBmakeuserdb\fR, of course, to create the binary database file
8d138742 243\fI@userdb@\.dat\fR
d9898ee8 244.PP
245NOTE: You are still required to create the
246\fB@userdb@\fR
8d138742 247entry which maps system userids back to accounts, "\fIuid\fR=<TAB>\fIname\fR", if that\'s applicable\.
d9898ee8 248\fBvchkpw2userdb\fR
8d138742 249will not do it for you\.
d9898ee8 250.PP
251NOTE:
252\fBmakeuserdb\fR
253may complain about duplicate entries, if your "default" entries in
254\fIusers/vpasswd\fR
255or
256\fIdomains/default/vpasswd\fR
257are the same as anything in any other
258\fI@userdb@\fR
8d138742 259file\. It is also likely that you\'ll end up with duplicate, but distinct, entries for every account in the default domain\. For example, if your default domain is example\.com, you\'ll end up with duplicate entries \- you\'ll have entries for both
d9898ee8 260\fIuser\fR
261and
8d138742 262\fIuser@example\.com\fR\.
d9898ee8 263.PP
264If you intend to maintain the master set of accounts using vchkpw/vpopmail, in order to avoid cleaning this up every time, you might want to consider doing the following: run
265\fBvchkpw2userdb\fR
266once, using the
267\fI\-\-todir\fR
8d138742
CE
268option\. Then, go into the resulting directory, and replace one of the redundant files with a soft link to
269\fI/dev/null\fR\. This allows you to run
d9898ee8 270\fBvchkpw2userdb\fR
8d138742 271without having to go in and cleaning up again, afterwards\.
d9898ee8 272.SH "FILES"
273.sp
274.RS 4
275.nf
276\fI@userdb@\fR
8d138742
CE
277\fI@userdb@\.dat\fR
278\fI@userdb@shadow\.dat\fR
279\fI@tmpdir@/userdb\.tmp\fR \- temporary file
280\fI@tmpdir@/userdbshadow\.tmp\fR \- temporary file
d9898ee8 281.fi
282.RE
283.SH "BUGS"
284.PP
285\fBmakeuserdb\fR
8d138742 286is a Perl script, and uses Perl\'s portable locking\. Perl\'s documentation notes that certain combinations of locking options may not work with some networks\.
d9898ee8 287.SH "SEE ALSO"
288.PP
289
290\fI\fBuserdb\fR(8)\fR\&[3],
291\fI\fBmaildrop\fR(8)\fR\&[4],
292\fI\fBcourier\fR(8)\fR\&[5],
8d138742
CE
293\fI\fBmaildirquota\fR(7)\fR\&[2]\.
294.SH "NOTES"
d9898ee8 295.IP " 1." 4
296\fBuserdbpw\fR(8)
297.RS 4
298\%userdbpw.html
299.RE
300.IP " 2." 4
301\fBmaildirquota\fR(7)
302.RS 4
303\%maildirquota.html
304.RE
305.IP " 3." 4
306\fBuserdb\fR(8)
307.RS 4
308\%userdb.html
309.RE
310.IP " 4." 4
311\fBmaildrop\fR(8)
312.RS 4
313\%maildrop.html
314.RE
315.IP " 5." 4
316\fBcourier\fR(8)
317.RS 4
318\%courier.html
319.RE