makeuserdb.html.in
上传用户:s81996212
上传日期:2007-01-04
资源大小:722k
文件大小:9k
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
- "http://www.w3.org/TR/REC-html40/loose.dtd">
- <html>
- <head>
- <title>makeuserdb - Create @userdb@.dat</title>
- <!-- $Id: makeuserdb.html.in,v 1.8 2000/03/06 17:41:12 mrsam Exp $ -->
- <!-- Copyright 1998 - 1999 Double Precision, Inc. See COPYING for -->
- <!-- distribution information. -->
- <!-- SECTION 8 -->
- <meta http-equiv="Content-Type" content="text/html">
- </head>
- <body text="#000000" bgcolor="#FFFFFF" link="#0000EE" vlink="#551A8B"
- alink="#FF0000">
- <h1>makeuserdb - Create @userdb@.dat</h1>
- <h2>SYNOPSIS</h2>
- <pre> makeuserdb
- pw2userdb
- vchkpw2userdb [ --vpopmailhome=dir ] [ --todir=dir ] </pre>
- <h2>DESCRIPTION</h2>
- <p>These commands are used to create the <code>@userdb@.dat</code> database.
- <code>makeuserdb</code> creates <code>@userdb@.dat</code> based on the
- contents of <code>@userdb@</code>. <code>@userdb@.dat</code> is used by
- <i>maildrop</i>, <i>Courier</i>, and other applications as a
- substitute/complement for your system password file. The usual purpose for
- <code>@userdb@.dat</code> is to specify "virtual" accounts - accounts that do
- not have an associated login. Typically all virtual accounts share the same
- system userid. <code>@userdb@.dat</code> can also be used as a replacement for
- 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 a binary database, instead of a text file.</p>
- <p>The <code>makeuserdb</code> command creates <code>@userdb@.dat</code> based
- on the contents of <code>@userdb@</code>. <code>@userdb@</code> is a plain
- text file, or a directory. If it is a directory, the contents of all files in
- the directory are simply concatenated together.</p>
- <p><code>makeuserdb</code> command can be safely executed during normal system
- activity.</p>
- <h2>Format of <code>@userdb@</code></h2>
- <code>@userdb@</code> 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. If <code>@userdb@</code> is a directory, each
- file in <code>@userdb@</code> is formatted the same way. Each line takes the
- following format:<br>
- <br>
- <pre>name<TAB>field=value|field=value</pre>
- <p><i>name</i> is the account name. If Courier is configured to treat
- lowercase and uppercase account names as identical, <i>name</i> MUST contain
- lowercase characters only. <i>name</i> is followed by exactly one tab
- character, then a list of field/value pairs separated by vertical slashes.
- <i>field</i> is the name of the field, <i>value</i> is the field value. The
- field value itself cannot contain slashes or control characters. Fields can be
- specified in any order. Here are all the currently defined fields. Note that
- not every field is used by every application that reads
- <code>@userdb@.dat</code>.</p>
- <ul>
- <li><code>uid</code> - <i>value</i> specifies a (possibly) unique numerical
- user ID for this account.<br>
- <br>
- </li>
- <li><code>gid</code> - <i>value</i> specifies a (possibly) unique numerical
- group ID for this account.<br>
- <br>
- </li>
- <li><code>home</code> - <i>value</i> specifies the account's home
- directory.<br>
- <br>
- </li>
- <li><code>shell</code> - <i>value</i> specifies the account's default
- shell.<br>
- <br>
- </li>
- <li><code>systempw</code> - <i>value</i> specifies the account's system
- password. See <a href="userdbpw.html">userdbpw(8)</a> for a way to set
- this field.<br>
- <br>
- </li>
- <li><code>pop3pw, esmtppw, imappw...</code> - <i>value</i> specifies a
- separate password used only for authenticating access via some service,
- such as POP3, IMAP, or anything else. If not defined, <i>systempw</i> is
- always used. This allows you to define separate passwords for each
- service, or always use the same password for everything, your choice.<br>
- <br>
- </li>
- <li><code>mail</code> - <i>value</i> specifies the location of the account's
- Maildir mailbox. If missing, the account's Maildir is expected to be
- present in the default location for system accounts.<br>
- <br>
- </li>
- <li><code>quota</code> - <i>value</i> specifies the quota for the account's
- Maildir. See maildirquota(8) for more information.</li>
- </ul>
- <p>The <code>uid</code>, <code>gid</code>, and <code>home</code> fields MUST
- be specified. The remaining fields are optional. If missing, system defaults
- will be used.<br>
- <br>
- </p>
- <pre>=uid<TAB>name</pre>
- <p>This entry is used to specify reverse mapping from userids to names.
- <i>uid</i> specifies the system userid, <i>name</i> specifies the system
- username. <i>name</i> must point to another record in <code>userdb</code>.</p>
- <h2>@userdb@shadow.dat</h2>
- <p>All fields whose name ends with 'pw' will NOT copied to
- <code>@userdb@.dat</code>. These fields will be copied to
- <code>@userdb@shadow.dat</code>. <code>makeuserdb</code> will turn off all
- group and world permissions on <code>@userdb@shadow.dat</code>.
- <code>makeuserdb</code> will also fail if <code>@userdb@</code> has any group
- or world permissions.</p>
- <h2>CONVERTING /etc/passwd and vpopmail to @userdb@ format</h2>
- <p>The <code>pw2userdb</code> script reads <code>/etc/passwd</code> and
- <code>/etc/shadow</code> then converts all entries to the format used in
- <code>@userdb@</code>, printing the result on standard output. The output can
- be redirected to <code>@userdb@</code>, or to a file in this subdirectory.
- Linear searches of <code>/etc/passwd</code> can be very slow when you have
- tens of thousands of accounts. Programs like <i>maildrop</i> always look in
- <code>@userdb@</code> first, so by having the system password file in the
- <code>@userdb@</code> it is possible to significantly reduce the amount of
- time it takes to look it up.</p>
- <p>After saving the output of <code>pw2userdb</code>, you must still run
- <code>makeuserdb</code> to create <code>@userdb@.dat</code>.</p>
- <p>The <code>vchkpw2userdb</code> script is used to convert vpopmail-style
- directory hierarchy to the <code>@userdb@</code> format.
- <code>vpopmail/vchkpw</code> is often used to implement virtual mailboxes that
- share the same userid.</p>
- <p>Generally, an account named 'vpopmail' is reserved for this purpose. In
- that account the file <code>users/vpasswd</code> has the same structure as
- <code>/etc/passwd</code>, and performs a similar function, except that all
- userid in <code>users/vpasswd</code> have the same userid. Additionally, the
- <code><i>domains</i></code> subdirectory is used to store virtual accounts for
- multiple domains. For example, <code>domains/example.com/vpasswd</code>
- contains the passwd file for domain <code>example.com</code>. Additionally,
- some systems implement a soft link, <code>domains/default</code>, that points
- to a domain that's considered a "default" domain.</p>
- <p>The <code>vchkpw2userdb</code> script takes all of this, and attempts to
- convert it into the <code>@userdb@</code> format. The
- <code>--vpopmailhost</code> option specifies the top level directory, if it is
- not the home directory of the vpopmail account.</p>
- <p>The <code>vchkpw2userdb</code> script prints the results on standard
- output. If specified, the --todir option, attempts to convert all
- <code>vpasswd</code> files one at a time, saving each one individually in
- <i>dir</i>. For example:</p>
- <p><code>mkdir @userdb@</code><br>
- <code>vchkpw2userdb --todir=@userdb@/vpopmail<br>
- <code>makeuserdb</code></code></p>
- <p>It is still necessary to run <code>makeuserdb</code>, of course, to create
- the binary database.</p>
- <p>NOTE: You are still required to create the @userdb@ entry which maps
- system userids back to accounts, <code>"=uid<TAB>name"</code>, if that's
- applicable. <code>vchkpw2userdb</code> will not do it for you.</p>
- <p>NOTE: <code>makeuserdb</code> may complain about duplicate entries, if
- your "default" entries in <code>users/vpasswd</code> or
- <code>domains/default/vpasswd</code> are the same as anything in any other
- <code>@userdb@</code> 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 <code>user</code> and
- <code>user@example.com</code>.</p>
- <p>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 <code>vchkpw2userdb</code> once, using the
- <code>--todir</code> option. Then, go into the resulting directory, and
- replace one of the redundant files with a soft link to <code>/dev/null</code>.
- This allows you to run <code>vchkpw2userdb</code> without having to go in and
- cleaning up again, afterwards.</p>
- <h2>FILES</h2>
- <ul>
- <li><code>@userdb@</code></li>
- <li><code>@userdb@.dat</code></li>
- <li><code>@userdb@shadow.dat</code></li>
- <li><code>@tmpdir@/userdb.tmp</code> - temporary file</li>
- <li><code>@tmpdir@/userdbshadow.tmp</code> - temporary file</li>
- </ul>
- <h2>BUGS</h2>
- <p><code>*pw</code> must be encrypted via crypt.</p>
- <p><code>makeuserdb</code> 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.</p>
- <h2>SEE ALSO</h2>
- <p><a href="userdb.html">userdb(8)</a>, maildrop(1), courier(1),
- maildirquota(8)</p>
- </body>
- </html>