1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257
|
.\" <!-- $Id: makeuserdb.sgml,v 1.1 2001/11/24 20:49:56 mrsam Exp $ -->
.\" <!-- Copyright 1998 - 2001 Double Precision, Inc. See COPYING for -->
.\" <!-- distribution information. -->
.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
.TH "MAKEUSERDB" "8" "28 December 2001" "Double Precision, Inc." ""
.SH NAME
make \- create @userdb@
.SH SYNOPSIS
\fBuserdb\fR
\fBpwuserdb\fR
\fBvchkpw2userdb\fR [ \fB--vpopmailhome=\fIdir\fB\fR] [ \fB--todir=\fIdir\fB\fR]
.SH "DESCRIPTION"
.PP
\fBmakeuserdb\fR creates \fI@userdb@.dat\fR from
the contents of \fI@userdb@\fR.
\fI@userdb@\fR's contents are described later in this document.
\fBMaildrop\fR,
\fBCourier\fR, and other applications use
\fI@userdb@.dat\fR as a
substitute/complement for your system password file.
The usual purpose for
\fI@userdb@.dat\fR 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.
\fI@userdb@.dat\fR 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
\fI@userdb.dat@\fR, which is a binary database,
instead of a flat text file that the system password file usually is.
.PP
The \fBmakeuserdb\fR command can be safely executed during
normal system activity.
.SS "FORMAT OF @USERDB@"
.PP
\fI@userdb@\fR 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.
\fI@userdb@\fR may be a directory instead of a plain file.
In that case all files in \fI@userdb@\fR are essentially
concatenated, and are treated as a single file.
Each line takes the following format:
.PP
.sp
.RS
.PP
.nf
\fIname\fR<TAB>\fIfield\fR=\fIvalue\fR|\fIfield\fR=\fIvalue\fR...
.fi
.RE
\fIname\fR is the account name.
\fIname\fR MUST contain only lowercase characters
If \fBCourier\fR is
configured to treat lowercase and uppercase account names as
identical, \fIname\fR is followed by exactly one tab
character, then a list of field/value pairs separated by vertical slashes.
\fIfield\fR is the name of the field,
\fIvalue\fR 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
\fI@userdb@.dat\fR.
.sp
.RS
.PP
\fIuid\fR - \fIvalue\fR is a (possibly)
unique numerical user ID for this account.
.PP
\fIgid\fR - \fIvalue\fR is a (possibly)
unique numerical group ID for this account.
.PP
\fIhome\fR - \fIvalue\fR is the account's home
directory.
.PP
\fIshell\fR - \fIvalue\fR is the account's default
login shell.
.PP
\fIsystempw\fR - \fIvalue\fR is the account's
password. See
\fBuserdbpw\fR(8)
for details on how to set up this field.
.PP
\fIpop3pw, esmtppw, imappw...\fR - \fIvalue\fR
specifies a separate password used only for authenticating access using a
specific service, such as POP3, IMAP, or anything else. If not defined,
\fIsystempw\fR 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.
.PP
\fImail\fR - \fIvalue\fR specifies the location of
the account's Maildir mailbox. This is an optional field that is normally
used when \fBuserdb\fR is used to provide aliases for other
mail accounts. For example, one particular multi-domain E-mail
service configuration
that's used by both \fBQmail\fR and
\fBCourier\fR 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 \fBuserdb\fR
entry for "user@example.com" is set up with \fImail\fR set to the
location of example-user's Maildir mailbox, thus hiding the internal
mail configuration from the E-mail account holder's view.
.PP
\fIquota\fR - \fIvalue\fR specifies the
maildir quota for the account's Maildir.
This has nothing to do with actual filesystem quotas.
\fBCourier\fR has a
software-based Maildir quota enforcement
mechanism which requires additional setup and configuration.
See
\fBmaildirquota\fR(7)
for additional information.
.RE
.SS "@USERDB@SHADOW.DAT"
.PP
All fields whose name ends with 'pw' will NOT copied to
\fI@userdb@.dat\fR. These fields will be copied to
\fI@userdb@shadow.dat\fR.
\fBmakeuserdb\fR creates \fI@userdb@shadow.dat\fR
without any group and world permissions.
Note that \fBmakeuserdb\fR reports an error
if \fB@userdb@\fR has any group
or world permissions.
.SS "CONVERTING /ETC/PASSWD AND VPOPMAIL TO @USERDB@ FORMAT"
.PP
\fBpw2userdb\fR reads the \fI/etc/passwd\fR and
\fI/etc/shadow\fR files and converts all entries to the
\fI@userdb@\fR format,
printing the result on standard output.
The output of \fBpw2userdb\fR
can be saved as \fB@userdb@\fR (or as some file in this
subdirectory).
Linear searches of \fI/etc/passwd\fR can
be very slow when you have
tens of thousands of accounts.
Programs like \fBmaildrop\fR always look in
\fI@userdb@\fR first.
By saving the system password file in
\fI@userdb@\fR it is possible to significantly reduce the
amount of
time it takes to look up this information.
.PP
After saving the output of \fBpw2userdb\fR, you must still run
\fBmakeuserdb\fR to create
\fI@userdb@.dat\fR.
.PP
\fBvchkpw2userdb\fR converts a vpopmail-style
directory hierarchy to the \fI@userdb@\fR format.
This is an external virtual domain management package that's often used
with \fBQmail\fR servers.
.PP
Generally, an account named 'vpopmail' is reserved for this purpose.
In
that account the file \fIusers/vpasswd\fR has the same
layout as
\fI/etc/passwd\fR, and performs a similar function, except
that all userid in \fIusers/vpasswd\fR have the same userid.
Additionally, the
\fIdomains\fR subdirectory stores virtual accounts for
multiple domains. For example,
\fIdomains/example.com/vpasswd\fR
has the passwd file for the domain \fIexample.com\fR.
Some systems also have a soft link, \fIdomains/default\fR,
that points to a domain that's considered a "default" domain.
.PP
The \fBvchkpw2userdb\fR reads all this information, and tries to
convert it into the \fI@userdb@\fR format. The
\fI--vpopmailhost\fR option specifies the top level
directory, if it is
not the home directory of the vpopmail account.
.PP
The \fBvchkpw2userdb\fR script prints the results on standard
output. If specified, the \fI--todir\fR option
tries to convert all
\fIvpasswd\fR files one at a time, saving each one
individually in \fIdir\fR. For example:
.sp
.RS
.PP
.nf
mkdir @userdb@
vchkpw2userdb --todir=@userdb@/vpopmail
makeuserdb
.fi
.RE
.PP
It is still necessary to run \fBmakeuserdb\fR, of course, to
create the binary database file \fI@userdb@.dat\fR
.PP
NOTE: You are still required to create the \fB@userdb@\fR entry
which maps
system userids back to accounts,
"\fIuid\fR=<TAB>\fIname\fR",
if that's applicable. \fBvchkpw2userdb\fR will not do it for
you.
.PP
NOTE: \fBmakeuserdb\fR may complain about duplicate entries, if
your "default" entries in \fIusers/vpasswd\fR or
\fIdomains/default/vpasswd\fR are the same as anything in any
other \fI@userdb@\fR 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 \fIuser\fR and
\fIuser@example.com\fR.
.PP
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 \fBvchkpw2userdb\fR once, using the
\fI--todir\fR option.
Then, go into the resulting directory, and
replace one of the redundant files with a soft link to
\fI/dev/null\fR.
This allows you to run
\fBvchkpw2userdb\fR without having to go in and
cleaning up again, afterwards.
.SH "FILES"
.PP
.nf
\fI@userdb@\fR
\fI@userdb@.dat\fR
\fI@userdb@shadow.dat\fR
\fI@tmpdir@/userdb.tmp\fR - temporary file
\fI@tmpdir@/userdbshadow.tmp\fR - temporary file
.fi
.SH "BUGS"
.PP
\fBmakeuserdb\fR 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.
.SH "SEE ALSO"
.PP
\fBuserdb\fR(8),
\fBmaildrop\fR(8),
\fBcourier\fR(8),
\fBmaildirquota\fR(7).
|