| 1 | <?xml version="1.0"?> |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><title>userdb</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"/><link rel="start" href="#userdb" title="userdb"/><link xmlns="" rel="stylesheet" type="text/css" href="manpage.css"/><meta xmlns="" name="MSSmartTagsPreventParsing" content="TRUE"/><link xmlns="" rel="icon" href="icon.gif" type="image/gif"/><!-- |
| 3 | |
| 4 | Copyright 1998 - 2007 Double Precision, Inc. See COPYING for distribution |
| 5 | information. |
| 6 | |
| 7 | --></head><body><div class="refentry" lang="en" xml:lang="en"><a id="userdb" shape="rect"> </a><div class="titlepage"/><div class="refnamediv"><h2>Name</h2><p>userdb — manipulate @userdb@</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">userdb</code> {<em class="replaceable"><code>addr</code></em>} set {<em class="replaceable"><code>field</code></em>=<em class="replaceable"><code>value</code></em>...}</p></div><div class="cmdsynopsis"><p><code class="command">userdb</code> {<em class="replaceable"><code>addr</code></em>} unset {<em class="replaceable"><code>field</code></em>...}</p></div><div class="cmdsynopsis"><p><code class="command">userdb</code> {<em class="replaceable"><code>addr</code></em>} del </p></div><div class="cmdsynopsis"><p><code class="command">userdb</code> {<em class="replaceable"><code>path/addr</code></em>} [ set | unset | del ] ... </p></div><div class="cmdsynopsis"><p><code class="command">userdb</code> -f {<em class="replaceable"><code>file</code></em>} {<em class="replaceable"><code>adr</code></em>} [ set | unset | del ] ... </p></div><div class="cmdsynopsis"><p><code class="command">userdb</code> -show {<em class="replaceable"><code>path</code></em>}</p></div><div class="cmdsynopsis"><p><code class="command">userdb</code> -show {<em class="replaceable"><code>path</code></em>} {<em class="replaceable"><code>addr</code></em>}</p></div><div class="cmdsynopsis"><p><code class="command">userdb</code> -show -f {<em class="replaceable"><code>file</code></em>}</p></div><div class="cmdsynopsis"><p><code class="command">userdb</code> -show -f {<em class="replaceable"><code>file</code></em>} {<em class="replaceable"><code>addr</code></em>}</p></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="id282008" shape="rect"> </a><h2>DESCRIPTION</h2><p> |
| 8 | <span><strong class="command">userdb</strong></span> is a convenient script to individually manipulate |
| 9 | entries in <code class="filename">@userdb@</code>. See |
| 10 | <a href="makeuserdb.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">makeuserdb</span>(8)</span></a> |
| 11 | for a description of its contents. <code class="filename">@userdb@</code> can always |
| 12 | be edited using any text editor, but <span><strong class="command">userdb</strong></span> is a |
| 13 | convenient way to modify this file from another script.</p><p> |
| 14 | <code class="filename">@userdb@</code> can also be a subdirectory, instead of a file. |
| 15 | Specify <code class="option"><em class="replaceable"><code>foo/bar/addr</code></em></code> to manipulate |
| 16 | <code class="option"><em class="replaceable"><code>addr</code></em></code> in the file |
| 17 | <code class="filename">@userdb@<em class="replaceable"><code>/foo/bar</code></em></code>. You can |
| 18 | also use the |
| 19 | <code class="option">-f</code> flag: <code class="option">-f |
| 20 | <em class="replaceable"><code>@userdb@/foo/bar</code></em></code> is equivalent. Use |
| 21 | whatever form makes the most sense to you.</p><p> |
| 22 | <code class="filename">@userdb@</code> must not have any group or world |
| 23 | permissions. That's |
| 24 | because its contents may include system passwords (depending upon the |
| 25 | application which uses this virtual user account database).</p><p> |
| 26 | Each line in <code class="filename">@userdb@</code> takes following form: |
| 27 | </p><div class="blockquote"><blockquote class="blockquote"><p> |
| 28 | <code class="computeroutput"> |
| 29 | <em class="replaceable"><code>addr</code></em><span class="token"><TAB></span><em class="replaceable"><code>field</code></em>=<em class="replaceable"><code>value</code></em>|<em class="replaceable"><code>field</code></em>=<em class="replaceable"><code>value</code></em>... |
| 30 | </code></p></blockquote></div><p> |
| 31 | <em class="replaceable"><code>addr</code></em> specifies a unique virtual address. It |
| 32 | is followed by a single |
| 33 | tab character, then a list of |
| 34 | <em class="replaceable"><code>field</code></em>=<em class="replaceable"><code>value</code></em> pairs, |
| 35 | separated by |
| 36 | vertical slash characters. See |
| 37 | <a href="makeuserdb.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">makeuserdb</span>(8)</span></a> |
| 38 | for field definitions.</p><p> |
| 39 | A text editor can be used to add blank lines or comments in |
| 40 | <code class="filename">@userdb@</code>. Any blank lines or comments are ignored by the |
| 41 | <span><strong class="command">userdb</strong></span> script.</p><p> |
| 42 | The names of the actual fields, and their contents, are defined entirely by |
| 43 | applications that use the <code class="filename">@userdb@</code> database, the |
| 44 | <span><strong class="command">userdb</strong></span> command just adds or removes arbitrary fields.</p><p> |
| 45 | For example:</p><div class="blockquote"><blockquote class="blockquote"><div class="informalexample"><div class="literallayout"><p><span><strong class="command">userdb default/info set mail=/home/mail/info</strong></span></p></div></div></blockquote></div><p> |
| 46 | This command accesses the address "info" in |
| 47 | <code class="filename">@userdb@/default</code>.</p><p> |
| 48 | If the second argument to <span><strong class="command">userdb</strong></span> is |
| 49 | "<em class="parameter"><code>set</code></em>", the |
| 50 | remaining arguments are taken as |
| 51 | <em class="parameter"><code><em class="replaceable"><code>field</code></em>=<em class="replaceable"><code>value</code></em></code></em> pairs, which are |
| 52 | added to the record for <em class="replaceable"><code>addr</code></em>. If there is no |
| 53 | record for <em class="replaceable"><code>addr</code></em>, a |
| 54 | new record will be appended to the file. If |
| 55 | <em class="replaceable"><code>addr</code></em> exists, any existing |
| 56 | values of any specified fields are removed. If |
| 57 | <em class="parameter"><code>=<em class="replaceable"><code>value</code></em></code></em> is missing, |
| 58 | <span><strong class="command">userdb</strong></span> stops and prompts for it. This is useful if |
| 59 | you're setting |
| 60 | a password field, where you do not want to specify the password on the command |
| 61 | line, which can be seen by the |
| 62 | <span class="citerefentry"><span class="refentrytitle">ps</span>(1)</span> |
| 63 | command. If <span><strong class="command">userdb</strong></span> is being |
| 64 | executed by a script, the value can be provided on standard input.</p><p>Use "<em class="parameter"><code>unset</code></em>" to delete fields from an existing |
| 65 | record. Use |
| 66 | "<em class="parameter"><code>del</code></em>" to delete all fields in the existing record, |
| 67 | plus the record itself.</p><div class="refsect2" lang="en" xml:lang="en"><a id="id325532" shape="rect"> </a><h3>DISPLAYING <code class="filename">@userdb@</code></h3><p> |
| 68 | If the first argument to userdb |
| 69 | is <em class="parameter"><code>-show</code></em>, <span><strong class="command">userdb</strong></span> |
| 70 | displays the contents of <code class="filename">@userdb@</code>. If |
| 71 | <code class="filename">@userdb@</code> is a |
| 72 | subdirectory, |
| 73 | <em class="parameter"><code><em class="replaceable"><code>path</code></em></code></em> must refer to a |
| 74 | specific file in <code class="filename">@userdb@</code>. The |
| 75 | <em class="parameter"><code>-f</code></em> option can be used instead of |
| 76 | <em class="parameter"><code><em class="replaceable"><code>path</code></em></code></em> in order to specify an |
| 77 | arbitrary file.</p><p> |
| 78 | If |
| 79 | <em class="parameter"><code><em class="replaceable"><code>addr</code></em></code></em> is not specified, |
| 80 | <span><strong class="command">userdb</strong></span> produces a list, on standard |
| 81 | output, containing all addresses found in the file, on per line. If |
| 82 | <em class="parameter"><code><em class="replaceable"><code>addr</code></em></code></em> is specified, |
| 83 | <span><strong class="command">userdb</strong></span> produces a list, on standard output, of |
| 84 | all the fields in <code class="filename">@userdb@</code> for this |
| 85 | <em class="parameter"><code><em class="replaceable"><code>addr</code></em></code></em>.</p></div><div class="refsect2" lang="en" xml:lang="en"><a id="id325639" shape="rect"> </a><h3>REBUILDING <code class="filename">@userdb@.dat</code></h3><p> |
| 86 | The actual virtual account/address database is |
| 87 | <code class="filename">@userdb@.dat</code>. |
| 88 | This is a binary database file. <span><strong class="command">@userdb@</strong></span> is the plain text |
| 89 | version. After running <span><strong class="command">userdb</strong></span>, execute the |
| 90 | <a href="makeuserdb.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">makeuserdb</span>(8)</span></a> command to rebuild |
| 91 | <code class="filename">@userdb@.dat</code> for the changes to take effect.</p></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="id325690" shape="rect"> </a><h2>BUGS</h2><p> |
| 92 | <em class="parameter"><code><em class="replaceable"><code>addr</code></em></code></em> must be unique. |
| 93 | If <code class="filename">@userdb@</code> is a subdirectory, |
| 94 | it's possible to create the same |
| 95 | <em class="parameter"><code><em class="replaceable"><code>addr</code></em></code></em> |
| 96 | in different files in the subdirectory. |
| 97 | This is an error that is not currently detected by <span><strong class="command">userdb</strong></span>, |
| 98 | however the subsequent |
| 99 | <a href="makeuserdb.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">makeuserdb</span>(8)</span></a> command |
| 100 | will fail with an error message.</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id325738" shape="rect"> </a><h2>FILES</h2><p> |
| 101 | <code class="filename"> @userdb@</code> - plain text file, or directory of plain text files</p><p> |
| 102 | <code class="filename"> .lock.filename</code> - lock file for <code class="filename">filename</code></p><p> |
| 103 | <code class="filename"> .tmp.filename</code> - temporary file used to create new contents of <code class="filename">filename</code></p></div><div class="refsect1" lang="en" xml:lang="en"><a id="id325782" shape="rect"> </a><h2>SEE ALSO</h2><p> |
| 104 | <a href="makeuserdb.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">makeuserdb</span>(8)</span></a>, |
| 105 | |
| 106 | <a href="userdbpw.html" target="_top" shape="rect"><span class="citerefentry"><span class="refentrytitle">userdbpw</span>(8)</span></a></p></div></div></body></html> |