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">
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.3</refmiscinfo>
15 <refname>idmap_script</refname>
16 <refpurpose>Samba's idmap_script Backend for Winbind</refpurpose>
20 <title>DESCRIPTION</title>
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.
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.
37 <title>IDMAP OPTIONS</title>
41 <term>range = low - high</term>
43 Defines the available matching uid and gid range for which the
44 backend is authoritative.
51 This option can be used to configure an external program
52 for performing id mappings.
59 <title>IDMAP SCRIPT</title>
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>.
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.
77 The script should accept the following command line options.
88 And it should return one of the following responses as a single line of
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.
109 <title>EXAMPLES</title>
112 This example shows how script is used as a the default idmap backend
113 using an external program via the script parameter:
118 idmap config * : backend = script
119 idmap config * : range = 1000000-2000000
120 idmap config * : script = /usr/local/samba/bin/idmap_script.sh
124 This shows a simple script to partially perform the task:
130 # Uncomment this if you want some logging
131 #echo $@ >> /tmp/idmap.sh.log
132 if [ "$1" == "SIDTOID" ]
134 # Note. The number returned has to be within the range defined
135 #echo "Sending UID:1000005" >> /tmp/idmap.sh.log
139 #echo "Sending ERR: No idea what to do" >> /tmp/idmap.sh.log
140 echo "ERR: No idea what to do"
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.
154 <title>AUTHOR</title>
157 The original Samba software and related utilities
158 were created by Andrew Tridgell. Samba is now developed
159 by the Samba Team as an Open Source project similar
160 to the way the Linux kernel is developed.