Imported Upstream version 0.63.0
[hcoop/debian/courier-authlib.git] / userdb / makeuserdb.8.in
1 .\" <!-- $Id: makeuserdb.sgml,v 1.8 2008/07/13 21:58:26 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.73.2 <http://docbook.sf.net/>
7 .\" Date: 08/23/2008
8 .\" Manual: Double Precision, Inc.
9 .\" Source: Double Precision, Inc.
10 .\"
11 .TH "MAKEUSERDB" "8" "08/23/2008" "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"
17 makeuserdb - 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
29 creates
30 \fI@userdb@\.dat\fR
31 from the contents of
32 \fI@userdb@\fR\.
33 \fI@userdb@\fR\'s contents are described later in this document\.
34 Maildrop,
35 Courier, and other applications use
36 \fI@userdb@\.dat\fR
37 as a substitute/complement for your system password file\. The usual purpose for
38 \fI@userdb@\.dat\fR
39 is 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
41 may 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
44 The
45 \fBmakeuserdb\fR
46 command can be safely executed during normal system activity\.
47 .PP
48 The
49 \fB\-f\fR
50 option creates
51 \fI\fIfilename\fR\fR\fI\.dat\fR
52 from
53 \fI\fIfilename\fR\fR, instead of the default
54 \fI@userdb@\.dat\fR
55 from
56 \fI@userdb@\fR\.
57 .SS "Format of \fI@userdb@\fR"
58 .PP
59
60 \fI@userdb@\fR
61 is 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
63 may be a directory instead of a plain file\. In that case all files in
64 \fI@userdb@\fR
65 are 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
74 is the account name\.
75 \fIname\fR
76 MUST contain only lowercase characters If
77 Courier
78 is configured to treat lowercase and uppercase account names as identical,
79 \fIname\fR
80 is followed by exactly one tab character, then a list of field/value pairs separated by vertical slashes\.
81 \fIfield\fR
82 is the name of the field,
83 \fIvalue\fR
84 is 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
91 is a (possibly) unique numerical user ID for this account\.
92 .PP
93
94 \fIgid\fR
95 \-
96 \fIvalue\fR
97 is a (possibly) unique numerical group ID for this account\.
98 .PP
99
100 \fIhome\fR
101 \-
102 \fIvalue\fR
103 is the account\'s home directory\.
104 .PP
105
106 \fIshell\fR
107 \-
108 \fIvalue\fR
109 is the account\'s default login shell\.
110 .PP
111
112 \fIsystempw\fR
113 \-
114 \fIvalue\fR
115 is the account\'s password\. See
116 \fI\fBuserdbpw\fR(8)\fR\&[1]
117 for details on how to set up this field\.
118 .PP
119
120 \fIpop3pw, esmtppw, imappw\.\.\.\fR
121 \-
122 \fIvalue\fR
123 specifies 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
125 is 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
131 specifies the location of the account\'s Maildir mailbox\. This is an optional field that is normally used when
132 \fBuserdb\fR
133 is used to provide aliases for other mail accounts\. For example, one particular multi\-domain E\-mail service configuration that\'s used by both
134 Qmail
135 and
136 Courier
137 servers 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
139 entry for "user@example\.com" is set up with
140 \fImail\fR
141 set 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
147 specifies the maildir quota for the account\'s Maildir\. This has nothing to do with actual filesystem quotas\.
148 Courier
149 has a software\-based Maildir quota enforcement mechanism which requires additional setup and configuration\. See
150 \fI\fBmaildirquota\fR(7)\fR\&[2]
151 for additional information\.
152 .SS "\fI@userdb@shadow\.dat\fR"
153 .PP
154 All 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
158 creates
159 \fI@userdb@shadow\.dat\fR
160 without any group and world permissions\. Note that
161 \fBmakeuserdb\fR
162 reports an error if
163 \fB@userdb@\fR
164 has 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
169 reads the
170 \fI/etc/passwd\fR
171 and
172 \fI/etc/shadow\fR
173 files and converts all entries to the
174 \fI@userdb@\fR
175 format, printing the result on standard output\. The output of
176 \fBpw2userdb\fR
177 can be saved as
178 \fB@userdb@\fR
179 (or as some file in this subdirectory)\. Linear searches of
180 \fI/etc/passwd\fR
181 can be very slow when you have tens of thousands of accounts\. Programs like
182 \fBmaildrop\fR
183 always look in
184 \fI@userdb@\fR
185 first\. By saving the system password file in
186 \fI@userdb@\fR
187 it is possible to significantly reduce the amount of time it takes to look up this information\.
188 .PP
189 After saving the output of
190 \fBpw2userdb\fR, you must still run
191 \fBmakeuserdb\fR
192 to create
193 \fI@userdb@\.dat\fR\.
194 .PP
195
196 \fBvchkpw2userdb\fR
197 converts a vpopmail\-style directory hierarchy to the
198 \fI@userdb@\fR
199 format\. This is an external virtual domain management package that\'s often used with
200 Qmail
201 servers\.
202 .PP
203 Generally, an account named \'vpopmail\' is reserved for this purpose\. In that account the file
204 \fIusers/vpasswd\fR
205 has the same layout as
206 \fI/etc/passwd\fR, and performs a similar function, except that all userid in
207 \fIusers/vpasswd\fR
208 have the same userid\. Additionally, the
209 \fIdomains\fR
210 subdirectory stores virtual accounts for multiple domains\. For example,
211 \fIdomains/example\.com/vpasswd\fR
212 has 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
216 The
217 \fBvchkpw2userdb\fR
218 reads all this information, and tries to convert it into the
219 \fI@userdb@\fR
220 format\. The
221 \fI\-\-vpopmailhost\fR
222 option specifies the top level directory, if it is not the home directory of the vpopmail account\.
223 .PP
224 The
225 \fBvchkpw2userdb\fR
226 script prints the results on standard output\. If specified, the
227 \fI\-\-todir\fR
228 option tries to convert all
229 \fIvpasswd\fR
230 files one at a time, saving each one individually in
231 \fIdir\fR\. For example:
232 .sp
233 .RS 4
234 .nf
235 mkdir @userdb@
236 vchkpw2userdb \-\-todir=@userdb@/vpopmail
237 makeuserdb
238 .fi
239 .RE
240 .PP
241 It is still necessary to run
242 \fBmakeuserdb\fR, of course, to create the binary database file
243 \fI@userdb@\.dat\fR
244 .PP
245 NOTE: You are still required to create the
246 \fB@userdb@\fR
247 entry which maps system userids back to accounts, "\fIuid\fR=<TAB>\fIname\fR", if that\'s applicable\.
248 \fBvchkpw2userdb\fR
249 will not do it for you\.
250 .PP
251 NOTE:
252 \fBmakeuserdb\fR
253 may complain about duplicate entries, if your "default" entries in
254 \fIusers/vpasswd\fR
255 or
256 \fIdomains/default/vpasswd\fR
257 are the same as anything in any other
258 \fI@userdb@\fR
259 file\. 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
261 and
262 \fIuser@example\.com\fR\.
263 .PP
264 If 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
266 once, using the
267 \fI\-\-todir\fR
268 option\. 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
271 without 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
286 is 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 "NOTES"
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