Remove misleading entry from vfs_streams_xattr man page
[bbaumbach/samba-autobuild/.git] / docs-xml / manpages / idmap_script.8.xml
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="idmap_script.8">
4
5 <refmeta>
6         <refentrytitle>idmap_script</refentrytitle>
7         <manvolnum>8</manvolnum>
8         <refmiscinfo class="source">Samba</refmiscinfo>
9         <refmiscinfo class="manual">System Administration tools</refmiscinfo>
10         <refmiscinfo class="version">4.7</refmiscinfo>
11 </refmeta>
12
13
14 <refnamediv>
15         <refname>idmap_script</refname>
16         <refpurpose>Samba's idmap_script Backend for Winbind</refpurpose>
17 </refnamediv>
18
19 <refsynopsisdiv>
20         <title>DESCRIPTION</title>
21
22         <para>
23         The idmap_script plugin is a substitute for the idmap_tdb2
24         backend used by winbindd for storing SID/uid/gid mapping tables
25         in clustered environments with Samba and CTDB. It is a read only
26         backend that uses a script to perform mapping.
27         </para>
28
29         <para>
30         It was developed out of the idmap_tdb2 back end and does not store
31         SID/uid/gid mappings in a TDB, since the winbind_cache tdb will
32         store the mappings once they are provided.
33         </para>
34 </refsynopsisdiv>
35
36 <refsect1>
37         <title>IDMAP OPTIONS</title>
38
39         <variablelist>
40                 <varlistentry>
41                 <term>range = low - high</term>
42                 <listitem><para>
43                         Defines the available matching uid and gid range for which the
44                         backend is authoritative.
45                 </para></listitem>
46                 </varlistentry>
47
48                 <varlistentry>
49                 <term>script</term>
50                 <listitem><para>
51                         This option can be used to configure an external program
52                         for performing id mappings.
53                 </para></listitem>
54                 </varlistentry>
55         </variablelist>
56 </refsect1>
57
58 <refsect1>
59         <title>IDMAP SCRIPT</title>
60
61         <para>
62         The tdb2 idmap backend supports an external program for performing id mappings
63         through the smb.conf option <parameter>idmap config * : script</parameter> or
64         its deprecated legacy form <parameter>idmap : script</parameter>.
65         </para>
66
67         <para>
68         The mappings obtained by the script are then stored in the idmap tdb2
69         database instead of mappings created by the incrementing id counters.
70         It is therefore important that the script covers the complete range of
71         SIDs that can be passed in for SID to Unix ID mapping, since otherwise
72         SIDs unmapped by the script might get mapped to IDs that had
73         previously been mapped by the script.
74         </para>
75
76         <para>
77         The script should accept the following command line options.
78         </para>
79
80         <programlisting>
81         SIDTOID S-1-xxxx
82         IDTOSID UID xxxx
83         IDTOSID GID xxxx
84         IDTOSID XID xxxx
85         </programlisting>
86
87         <para>
88         And it should return one of the following responses as a single line of
89         text.
90         </para>
91
92         <programlisting>
93         UID:yyyy
94         GID:yyyy
95         XID:yyyy
96         SID:ssss
97         ERR:yyyy
98         </programlisting>
99
100         <para>
101         XID indicates that the ID returned should be both a UID and a GID.
102         That is, it requests an ID_TYPE_BOTH, but it is ultimately up to
103         the script whether or not it can honor that request. It can choose
104         to return a UID or a GID mapping only.
105         </para>
106 </refsect1>
107
108 <refsect1>
109         <title>EXAMPLES</title>
110
111         <para>
112         This example shows how script is used as a the default idmap backend
113         using an external program via the script parameter:
114         </para>
115
116         <programlisting>
117         [global]
118         idmap config * : backend = script
119         idmap config * : range = 1000000-2000000
120         idmap config * : script = /usr/local/samba/bin/idmap_script.sh
121         </programlisting>
122
123         <para>
124         This shows a simple script to partially perform the task:
125         </para>
126
127         <programlisting>
128         #!/bin/sh
129         #
130         # Uncomment this if you want some logging
131         #echo $@ >> /tmp/idmap.sh.log
132         if [ "$1" == "SIDTOID" ]
133         then
134                 # Note. The number returned has to be within the range defined
135                 #echo "Sending UID:1000005" >> /tmp/idmap.sh.log
136                 echo "UID:1000005"
137                 exit 0
138         else
139                 #echo "Sending ERR: No idea what to do" >> /tmp/idmap.sh.log
140                 echo "ERR: No idea what to do"
141                 exit 1
142         fi
143         </programlisting>
144
145         <para>
146         Clearly, this script is not enough, as it should probably use wbinfo
147         to determine if an incoming SID is a user or group SID and then
148         look up the mapping in a table or use some other mechanism for
149         mapping SIDs to UIDs and etc.
150         </para>
151
152         <para>
153           Please be aware that the script is called with the
154           _NO_WINBINDD environment variable set to 1. This prevents
155           recursive calls into winbind from the script both via
156           explicit calls to wbinfo and via implicit calls via
157           nss_winbind. For example a call to <command>ls -l</command>
158           could trigger such an infinite recursion.
159         </para>
160
161         <para>
162           It is safe to call <command>wbinfo -n</command> and
163           <command>wbinfo -s</command> from within an idmap script. To
164           do so, the script must unset the _NO_WINBINDD environment
165           variable right before the call to <command>wbinfo</command>
166           and set it to 1 again right after <command>wbinfo</command>
167           has returned to protect against the recursion.
168         </para>
169 </refsect1>
170
171 <refsect1>
172         <title>AUTHOR</title>
173
174         <para>
175         The original Samba software and related utilities
176         were created by Andrew Tridgell. Samba is now developed
177         by the Samba Team as an Open Source project similar
178         to the way the Linux kernel is developed.
179         </para>
180 </refsect1>
181
182 </refentry>