Build courier-authlib 0.60.2-0hcoop1.
[hcoop/debian/courier-authlib.git] / userdb / makeuserdb.8.in
CommitLineData
d9898ee8 1.\" <!-- $Id: makeuserdb.sgml,v 1.7 2007/04/22 15:05:16 mrsam Exp $ -->
2.\" <!-- Copyright 1998 - 2007 Double Precision, Inc. See COPYING for -->
3.\" <!-- distribution information. -->
4.\" Title: makeuserdb
5.\" Author:
6.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
7.\" Date: 04/22/2007
8.\" Manual: Double Precision, Inc.
9.\" Source: Double Precision, Inc.
10.\"
11.TH "MAKEUSERDB" "8" "04/22/2007" "Double Precision, Inc." "Double Precision, Inc."
12.\" disable hyphenation
13.nh
14.\" disable justification (adjust text to left margin only)
15.ad l
16.SH "NAME"
17make \- create @userdb@
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
30\fI@userdb@.dat\fR
31from the contents of
32\fI@userdb@\fR.
33\fI@userdb@\fR's contents are described later in this document.
34Maildrop,
35Courier, and other applications use
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.
43.PP
44The
45\fBmakeuserdb\fR
46command can be safely executed during normal system activity.
47.PP
48The
49\fB\-f\fR
50option creates
51\fI\fIfilename\fR\fR\fI.dat\fR
52from
53\fI\fIfilename\fR\fR, instead of the default
54\fI@userdb@.dat\fR
55from
56\fI@userdb@\fR.
57.SS "Format of \fI@userdb@\fR"
58.PP
59
60\fI@userdb@\fR
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.
62\fI@userdb@\fR
63may be a directory instead of a plain file. In that case all files in
64\fI@userdb@\fR
65are essentially concatenated, and are treated as a single file. Each line takes the following format:
66.sp
67.RS 4
68.nf
69\fIname\fR<TAB>\fIfield\fR=\fIvalue\fR|\fIfield\fR=\fIvalue\fR...
70.fi
71.RE
72.PP
73\fIname\fR
74is the account name.
75\fIname\fR
76MUST contain only lowercase characters If
77Courier
78is configured to treat lowercase and uppercase account names as identical,
79\fIname\fR
80is followed by exactly one tab character, then a list of field/value pairs separated by vertical slashes.
81\fIfield\fR
82is the name of the field,
83\fIvalue\fR
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.
86.PP
87
88\fIuid\fR
89\-
90\fIvalue\fR
91is a (possibly) unique numerical user ID for this account.
92.PP
93
94\fIgid\fR
95\-
96\fIvalue\fR
97is a (possibly) unique numerical group ID for this account.
98.PP
99
100\fIhome\fR
101\-
102\fIvalue\fR
103is the account's home directory.
104.PP
105
106\fIshell\fR
107\-
108\fIvalue\fR
109is the account's default login shell.
110.PP
111
112\fIsystempw\fR
113\-
114\fIvalue\fR
115is the account's password. See
116\fI\fBuserdbpw\fR(8)\fR\&[1]
117for details on how to set up this field.
118.PP
119
120\fIpop3pw, esmtppw, imappw...\fR
121\-
122\fIvalue\fR
123specifies a separate password used only for authenticating access using a specific service, such as POP3, IMAP, or anything else. If not defined,
124\fIsystempw\fR
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.
126.PP
127
128\fImail\fR
129\-
130\fIvalue\fR
131specifies the location of the account's Maildir mailbox. This is an optional field that is normally used when
132\fBuserdb\fR
133is used to provide aliases for other mail accounts. For example, one particular multi\-domain E\-mail service configuration that's used by both
134Qmail
135and
136Courier
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
138\fBuserdb\fR
139entry for "user@example.com" is set up with
140\fImail\fR
141set to the location of example\-user's Maildir mailbox, thus hiding the internal mail configuration from the E\-mail account holder's view.
142.PP
143
144\fIquota\fR
145\-
146\fIvalue\fR
147specifies the maildir quota for the account's Maildir. This has nothing to do with actual filesystem quotas.
148Courier
149has a software\-based Maildir quota enforcement mechanism which requires additional setup and configuration. See
150\fI\fBmaildirquota\fR(7)\fR\&[2]
151for additional information.
152.SS "\fI@userdb@shadow.dat\fR"
153.PP
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.
157\fBmakeuserdb\fR
158creates
159\fI@userdb@shadow.dat\fR
160without any group and world permissions. Note that
161\fBmakeuserdb\fR
162reports an error if
163\fB@userdb@\fR
164has any group or world permissions.
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
175format, printing the result on standard output. The output of
176\fBpw2userdb\fR
177can be saved as
178\fB@userdb@\fR
179(or as some file in this subdirectory). Linear searches of
180\fI/etc/passwd\fR
181can be very slow when you have tens of thousands of accounts. Programs like
182\fBmaildrop\fR
183always look in
184\fI@userdb@\fR
185first. By saving the system password file in
186\fI@userdb@\fR
187it is possible to significantly reduce the amount of time it takes to look up this information.
188.PP
189After saving the output of
190\fBpw2userdb\fR, you must still run
191\fBmakeuserdb\fR
192to create
193\fI@userdb@.dat\fR.
194.PP
195
196\fBvchkpw2userdb\fR
197converts a vpopmail\-style directory hierarchy to the
198\fI@userdb@\fR
199format. This is an external virtual domain management package that's often used with
200Qmail
201servers.
202.PP
203Generally, an account named 'vpopmail' is reserved for this purpose. In that account the file
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
208have the same userid. Additionally, the
209\fIdomains\fR
210subdirectory stores virtual accounts for multiple domains. For example,
211\fIdomains/example.com/vpasswd\fR
212has the passwd file for the domain
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.
215.PP
216The
217\fBvchkpw2userdb\fR
218reads all this information, and tries to convert it into the
219\fI@userdb@\fR
220format. The
221\fI\-\-vpopmailhost\fR
222option specifies the top level directory, if it is not the home directory of the vpopmail account.
223.PP
224The
225\fBvchkpw2userdb\fR
226script prints the results on standard output. If specified, the
227\fI\-\-todir\fR
228option tries to convert all
229\fIvpasswd\fR
230files one at a time, saving each one individually in
231\fIdir\fR. For example:
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
243\fI@userdb@.dat\fR
244.PP
245NOTE: You are still required to create the
246\fB@userdb@\fR
247entry which maps system userids back to accounts, "\fIuid\fR=<TAB>\fIname\fR", if that's applicable.
248\fBvchkpw2userdb\fR
249will not do it for you.
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
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
260\fIuser\fR
261and
262\fIuser@example.com\fR.
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
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
270\fBvchkpw2userdb\fR
271without having to go in and cleaning up again, afterwards.
272.SH "FILES"
273.sp
274.RS 4
275.nf
276\fI@userdb@\fR
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
281.fi
282.RE
283.SH "BUGS"
284.PP
285\fBmakeuserdb\fR
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.
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],
293\fI\fBmaildirquota\fR(7)\fR\&[2].
294.SH "REFERENCES"
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