Initial import
[samba] / docs / htmldocs / Samba3-HOWTO / groupmapping.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter 11. Group Mapping: MS Windows and UNIX</title><link rel="stylesheet" href="samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.68.1"><link rel="start" href="index.html" title="The Official Samba-3 HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part III. Advanced Configuration"><link rel="prev" href="passdb.html" title="Chapter 10. Account Information Databases"><link rel="next" href="NetCommand.html" title="Chapter 12. Remote and Local Management: The Net Command"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter 11. Group Mapping: MS Windows and UNIX</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="passdb.html">Prev</a> </td><th width="60%" align="center">Part III. Advanced Configuration</th><td width="20%" align="right"> <a accesskey="n" href="NetCommand.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="groupmapping"></a>Chapter 11. Group Mapping: MS Windows and UNIX</h2></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:jht@samba.org">jht@samba.org</a>&gt;</code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jean François</span> <span class="surname">Micouleau</span></h3></div></div><div><div class="author"><h3 class="author"><span class="firstname">Gerald</span> <span class="othername">(Jerry)</span> <span class="surname">Carter</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email">&lt;<a href="mailto:jerry@samba.org">jerry@samba.org</a>&gt;</code></p></div></div></div></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="groupmapping.html#id2563638">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="groupmapping.html#id2564045">Discussion</a></span></dt><dd><dl><dt><span class="sect2"><a href="groupmapping.html#id2564380">Warning: User Private Group Problems</a></span></dt><dt><span class="sect2"><a href="groupmapping.html#id2564438">Nested Groups: Adding Windows Domain Groups to Windows Local Groups</a></span></dt><dt><span class="sect2"><a href="groupmapping.html#id2565014">Important Administrative Information</a></span></dt><dt><span class="sect2"><a href="groupmapping.html#id2565255">Default Users, Groups, and Relative Identifiers</a></span></dt><dt><span class="sect2"><a href="groupmapping.html#id2565888">Example Configuration</a></span></dt></dl></dd><dt><span class="sect1"><a href="groupmapping.html#id2565964">Configuration Scripts</a></span></dt><dd><dl><dt><span class="sect2"><a href="groupmapping.html#id2565976">Sample <code class="filename">smb.conf</code> Add Group Script</a></span></dt><dt><span class="sect2"><a href="groupmapping.html#id2566149">Script to Configure Group Mapping</a></span></dt></dl></dd><dt><span class="sect1"><a href="groupmapping.html#id2566253">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="groupmapping.html#id2566266">Adding Groups Fails</a></span></dt><dt><span class="sect2"><a href="groupmapping.html#id2566347">Adding Domain Users to the Workstation Power Users Group</a></span></dt></dl></dd></dl></div><p>
2 <a class="indexterm" name="id2563512"></a>
3 <a class="indexterm" name="id2563521"></a>
4 <a class="indexterm" name="id2563528"></a>
5 <a class="indexterm" name="id2563535"></a>
6 <a class="indexterm" name="id2563541"></a>
7 <a class="indexterm" name="id2563548"></a>
8         Starting with Samba-3, new group mapping functionality is available to create associations
9         between Windows group SIDs and UNIX groups. The <span><strong class="command">groupmap</strong></span> subcommand
10         included with the <span class="application">net</span> tool can be used to manage these associations.
11         </p><p>
12 <a class="indexterm" name="id2563573"></a>
13 <a class="indexterm" name="id2563580"></a>
14         The new facility for mapping NT groups to UNIX system groups allows the administrator to decide
15         which NT domain groups are to be exposed to MS Windows clients. Only those NT groups that map
16         to a UNIX group that has a value other than the default (<code class="constant">-1</code>) will be exposed
17         in group selection lists in tools that access domain users and groups.
18         </p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
19         <a class="indexterm" name="id2563602"></a>
20 <a class="indexterm" name="id2563608"></a>
21         The <em class="parameter"><code>domain admin group</code></em> parameter has been removed in Samba-3 and should no longer
22         be specified in <code class="filename">smb.conf</code>. In Samba-2.2.x, this parameter was used to give the listed users membership in the
23         <code class="constant">Domain Admins</code> Windows group, which gave local admin rights on their workstations
24         (in default configurations).
25         </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2563638"></a>Features and Benefits</h2></div></div></div><p>
26         Samba allows the administrator to create MS Windows NT4/200x group accounts and to
27         arbitrarily associate them with UNIX/Linux group accounts.
28         </p><p>
29         <a class="indexterm" name="id2563652"></a>
30         <a class="indexterm" name="id2563658"></a>
31         <a class="indexterm" name="id2563665"></a>
32 <a class="indexterm" name="id2563671"></a>
33 <a class="indexterm" name="id2563678"></a>
34 <a class="indexterm" name="id2563685"></a>
35 <a class="indexterm" name="id2563692"></a>
36         Group accounts can be managed using the MS Windows NT4 or MS Windows 200x/XP Professional MMC tools.
37         Appropriate interface scripts should be provided in <code class="filename">smb.conf</code> if it is desired that UNIX/Linux system
38         accounts should be automatically created when these tools are used. In the absence of these scripts, and
39         so long as <span><strong class="command">winbindd</strong></span> is running, Samba group accounts that are created using these
40         tools will be allocated UNIX UIDs and GIDs from the ID range specified by the
41         <a class="indexterm" name="id2563718"></a>idmap uid/<a class="indexterm" name="id2563725"></a>idmap gid
42         parameters in the <code class="filename">smb.conf</code> file.
43         </p><div class="figure"><a name="idmap-sid2gid"></a><p class="title"><b>Figure 11.1. IDMAP: Group SID-to-GID Resolution.</b></p><div class="mediaobject"><img src="images/idmap-sid2gid.png" width="270" alt="IDMAP: Group SID-to-GID Resolution."></div></div><div class="figure"><a name="idmap-gid2sid"></a><p class="title"><b>Figure 11.2. IDMAP: GID Resolution to Matching SID.</b></p><div class="mediaobject"><img src="images/idmap-gid2sid.png" width="270" alt="IDMAP: GID Resolution to Matching SID."></div></div><p>
44         <a class="indexterm" name="id2563826"></a>
45 <a class="indexterm" name="id2563832"></a>
46 <a class="indexterm" name="id2563839"></a>
47 <a class="indexterm" name="id2563848"></a>
48         In both cases, when winbindd is not running, only locally resolvable groups can be recognized. Please refer to
49         <a href="groupmapping.html#idmap-sid2gid" title="Figure 11.1. IDMAP: Group SID-to-GID Resolution.">IDMAP: Group SID-to-GID Resolution</a> and <a href="groupmapping.html#idmap-gid2sid" title="Figure 11.2. IDMAP: GID Resolution to Matching SID.">IDMAP: GID Resolution to Matching SID</a>.  The <span><strong class="command">net groupmap</strong></span> is
50         used to establish UNIX group to NT SID mappings as shown in <a href="groupmapping.html#idmap-store-gid2sid" title="Figure 11.3. IDMAP Storing Group Mappings.">IDMAP: storing
51         group mappings</a>.
52         </p><div class="figure"><a name="idmap-store-gid2sid"></a><p class="title"><b>Figure 11.3. IDMAP Storing Group Mappings.</b></p><div class="mediaobject"><img src="images/idmap-store-gid2sid.png" width="270" alt="IDMAP Storing Group Mappings."></div></div><p>
53         <a class="indexterm" name="id2563934"></a>
54         <a class="indexterm" name="id2563941"></a>
55 <a class="indexterm" name="id2563948"></a>
56 <a class="indexterm" name="id2563954"></a>
57         Administrators should be aware that where <code class="filename">smb.conf</code> group interface scripts make
58         direct calls to the UNIX/Linux system tools (the shadow utilities, <span><strong class="command">groupadd</strong></span>,
59         <span><strong class="command">groupdel</strong></span>, and <span><strong class="command">groupmod</strong></span>), the resulting UNIX/Linux group names will be subject
60         to any limits imposed by these tools. If the tool does not allow uppercase characters
61         or space characters, then the creation of an MS Windows NT4/200x-style group of
62         <code class="literal">Engineering Managers</code> will attempt to create an identically named
63         UNIX/Linux group, an attempt that will of course fail.
64         </p><p>
65         <a class="indexterm" name="id2564002"></a>
66         <a class="indexterm" name="id2564008"></a>
67         There are several possible workarounds for the operating system tools limitation. One
68         method is to use a script that generates a name for the UNIX/Linux system group that
69         fits the operating system limits and that then just passes the UNIX/Linux group ID (GID)
70         back to the calling Samba interface. This will provide a dynamic workaround solution.
71         </p><p>
72 <a class="indexterm" name="id2564024"></a>
73         Another workaround is to manually create a UNIX/Linux group, then manually create the
74         MS Windows NT4/200x group on the Samba server, and then use the <span><strong class="command">net groupmap</strong></span>
75         tool to connect the two to each other.
76         </p></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2564045"></a>Discussion</h2></div></div></div><p>
77 <a class="indexterm" name="id2564052"></a>
78 <a class="indexterm" name="id2564059"></a>
79         When you install <span class="application">MS Windows NT4/200x</span> on a computer, the installation
80         program creates default users and groups, notably the <code class="constant">Administrators</code> group,
81         and gives that group privileges necessary to perform essential system tasks,
82         such as the ability to change the date and time or to kill (or close) any process running on the
83         local machine.
84         </p><p>
85         <a class="indexterm" name="id2564084"></a>
86         The <code class="constant">Administrator</code> user is a member of the <code class="constant">Administrators</code> group, and thus inherits
87         <code class="constant">Administrators</code> group privileges. If a <code class="constant">joe</code> user is created to be a member of the
88         <code class="constant">Administrators</code> group, <code class="constant">joe</code> has exactly the same rights as the user
89         <code class="constant">Administrator</code>.
90         </p><p>
91 <a class="indexterm" name="id2564123"></a>
92 <a class="indexterm" name="id2564130"></a>
93 <a class="indexterm" name="id2564136"></a>
94 <a class="indexterm" name="id2564143"></a>
95         When an MS Windows NT4/200x/XP machine is made a domain member, the &#8220;<span class="quote">Domain Admins</span>&#8221; group of the
96         PDC is added to the local <code class="constant">Administrators</code> group of the workstation. Every member of the
97         <code class="constant">Domain Admins</code> group inherits the rights of the local <code class="constant">Administrators</code> group when
98         logging on the workstation.
99         </p><p>
100 <a class="indexterm" name="id2564172"></a>
101 <a class="indexterm" name="id2564179"></a>
102         The following steps describe how to make Samba PDC users members of the <code class="constant">Domain Admins</code> group.
103         </p><div class="orderedlist"><ol type="1"><li><p>
104                 Create a UNIX group (usually in <code class="filename">/etc/group</code>); let's call it <code class="constant">domadm</code>.
105                 </p></li><li><p>
106 <a class="indexterm" name="id2564217"></a>
107                 Add to this group the users that must be &#8220;<span class="quote">Administrators</span>&#8221;. For example,
108                 if you want <code class="constant">joe, john</code>, and <code class="constant">mary</code> to be administrators,
109                 your entry in <code class="filename">/etc/group</code> will look like this:
110                 </p><pre class="programlisting">
111                 domadm:x:502:joe,john,mary
112                 </pre><p>
113                 </p></li><li><p>
114                 Map this domadm group to the &#8220;<span class="quote">Domain Admins</span>&#8221; group by running the command:
115                 </p><p>
116 </p><pre class="screen">
117 <code class="prompt">root# </code><strong class="userinput"><code>net groupmap add ntgroup="Domain Admins" unixgroup=domadm</code></strong>
118 </pre><p>
119                 </p><p>
120                 <a class="indexterm" name="id2564284"></a>
121                 The quotes around &#8220;<span class="quote">Domain Admins</span>&#8221; are necessary due to the space in the group name.
122                 Also make sure to leave no white space surrounding the equal character (=).
123                 </p></li></ol></div><p>
124         Now <code class="constant">joe, john</code>, and <code class="constant">mary</code> are domain administrators.
125         </p><p>
126         <a class="indexterm" name="id2564313"></a>
127         It is possible to map any arbitrary UNIX group to any Windows NT4/200x group as well as
128         to make any UNIX group a Windows domain group. For example, if you wanted to include a
129         UNIX group (e.g., acct) in an ACL on a local file or printer on a Domain Member machine,
130         you would flag that group as a domain group by running the following on the Samba PDC:
131         </p><p>
132 </p><pre class="screen">
133 <code class="prompt">root# </code><strong class="userinput"><code>net groupmap add rid=1000 ntgroup="Accounting" unixgroup=acct</code></strong>
134 </pre><p>
135         The <code class="literal">ntgroup</code> value must be in quotes if it contains space characters to prevent
136         the space from being interpreted as a command delimiter.
137         </p><p>
138 <a class="indexterm" name="id2564360"></a>
139 <a class="indexterm" name="id2564366"></a>
140         Be aware that the RID parameter is an unsigned 32-bit integer that should
141         normally start at 1000. However, this RID must not overlap with any RID assigned
142         to a user. Verification for this is done differently depending on the passdb backend
143         you are using. Future versions of the tools may perform the verification automatically,
144         but for now the burden is on you.
145         </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2564380"></a>Warning: User Private Group Problems</h3></div></div></div><p>
146 <a class="indexterm" name="id2564389"></a>
147 <a class="indexterm" name="id2564396"></a>
148 <a class="indexterm" name="id2564402"></a>
149         Windows does not permit user and group accounts to have the same name.
150         This has serious implications for all sites that use private group accounts.
151         A private group account is an administrative practice whereby users are each
152         given their own group account. Red Hat Linux, as well as several free distributions
153         of Linux, by default create private groups.
154         </p><p>
155 <a class="indexterm" name="id2564419"></a>
156 <a class="indexterm" name="id2564426"></a>
157         When mapping a UNIX/Linux group to a Windows group account, all conflict can
158         be avoided by assuring that the Windows domain group name does not overlap
159         with any user account name.
160         </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2564438"></a>Nested Groups: Adding Windows Domain Groups to Windows Local Groups</h3></div></div></div><a class="indexterm" name="id2564444"></a><p>
161 <a class="indexterm" name="id2564456"></a>
162         This functionality is known as <code class="constant">nested groups</code> and was first added to
163         Samba-3.0.3.
164         </p><p>
165 <a class="indexterm" name="id2564471"></a>
166         All MS Windows products since the release of Windows NT 3.10 support the use of nested groups.
167         Many Windows network administrators depend on this capability because it greatly simplifies security
168         administration.
169         </p><p>
170 <a class="indexterm" name="id2564485"></a>
171 <a class="indexterm" name="id2564492"></a>
172 <a class="indexterm" name="id2564499"></a>
173 <a class="indexterm" name="id2564506"></a>
174 <a class="indexterm" name="id2564513"></a>
175 <a class="indexterm" name="id2564520"></a>
176 <a class="indexterm" name="id2564527"></a>
177         The nested group architecture was designed with the premise that day-to-day user and group membership
178         management should be performed on the domain security database. The application of group security
179         should be implemented on domain member servers using only local groups. On the domain member server,
180         all file system security controls are then limited to use of the local groups, which will contain
181         domain global groups and domain global users.
182         </p><p>
183 <a class="indexterm" name="id2564545"></a>
184 <a class="indexterm" name="id2564552"></a>
185 <a class="indexterm" name="id2564559"></a>
186         You may ask, What are the benefits of this arrangement? The answer is obvious to those who have plumbed
187         the dark depths of Windows networking architecture. Consider for a moment a server on which are stored
188         200,000 files, each with individual domain user and domain group settings. The company that owns the
189         file server is bought by another company, resulting in the server being moved to another location, and then
190         it is made a member of a different domain. Who would you think now owns all the files and directories?
191         Answer: Account Unknown.
192         </p><p>
193 <a class="indexterm" name="id2564578"></a>
194 <a class="indexterm" name="id2564585"></a>
195 <a class="indexterm" name="id2564592"></a>
196 <a class="indexterm" name="id2564599"></a>
197         Unraveling the file ownership mess is an unenviable administrative task that can be avoided simply
198         by using local groups to control all file and directory access control. In this case, only the members
199         of the local groups will have been lost. The files and directories in the storage subsystem will still
200         be owned by the local groups. The same goes for all ACLs on them. It is administratively much simpler
201         to delete the <code class="constant">Account Unknown</code> membership entries inside local groups with appropriate
202         entries for domain global groups in the new domain that the server has been made a member of.
203         </p><p>
204 <a class="indexterm" name="id2564622"></a>
205 <a class="indexterm" name="id2564629"></a>
206 <a class="indexterm" name="id2564636"></a>
207 <a class="indexterm" name="id2564643"></a>
208 <a class="indexterm" name="id2564650"></a>
209 <a class="indexterm" name="id2564657"></a>
210 <a class="indexterm" name="id2564664"></a>
211 <a class="indexterm" name="id2564671"></a>
212         Another prominent example of the use of nested groups involves implementation of administrative privileges
213         on domain member workstations and servers. Administrative privileges are given to all members of the
214         built-in local group <code class="constant">Administrators</code> on each domain member machine. To ensure that all domain
215         administrators have full rights on the member server or workstation, on joining the domain, the
216         <code class="constant">Domain Admins</code> group is added to the local Administrators group. Thus everyone who is
217         logged into the domain as a member of the Domain Admins group is also granted local administrative
218         privileges on each domain member.
219         </p><p>
220 <a class="indexterm" name="id2564699"></a>
221 <a class="indexterm" name="id2564706"></a>
222 <a class="indexterm" name="id2564713"></a>
223 <a class="indexterm" name="id2564720"></a>
224         UNIX/Linux has no concept of support for nested groups, and thus Samba has for a long time not supported
225         them either. The problem is that you would have to enter UNIX groups as auxiliary members of a group in
226         <code class="filename">/etc/group</code>. This does not work because it was not a design requirement at the time
227         the UNIX file system security model was implemented. Since Samba-2.2, the winbind daemon can provide
228         <code class="filename">/etc/group</code> entries on demand by obtaining user and group information from the domain
229         controller that the Samba server is a member of.
230         </p><p>
231 <a class="indexterm" name="id2564750"></a>
232 <a class="indexterm" name="id2564757"></a>
233 <a class="indexterm" name="id2564764"></a>
234 <a class="indexterm" name="id2564771"></a>
235 <a class="indexterm" name="id2564778"></a>
236         In effect, Samba supplements the <code class="filename">/etc/group</code> data via the dynamic
237         <span><strong class="command">libnss_winbind</strong></span> mechanism. Beginning with Samba-3.0.3, this facility is used to provide
238         local groups in the same manner as Windows does it. It works by expanding the local groups on the
239         fly as they are accessed. For example, the <code class="constant">Domain Users</code> group of the domain is made
240         a member of the local group <code class="constant">demo</code>. Whenever Samba needs to resolve membership of the
241         <code class="constant">demo</code> local (alias) group, winbind asks the domain controller for demo members of the Domain Users
242         group. By definition, it can only contain user objects, which can then be faked to be member of the
243         UNIX/Linux group <code class="constant">demo</code>.
244         </p><p>
245 <a class="indexterm" name="id2564824"></a>
246 <a class="indexterm" name="id2564831"></a>
247 <a class="indexterm" name="id2564838"></a>
248 <a class="indexterm" name="id2564845"></a>
249 <a class="indexterm" name="id2564851"></a>
250 <a class="indexterm" name="id2564858"></a>
251 <a class="indexterm" name="id2564865"></a>
252         To enable the use of nested groups, <span><strong class="command">winbindd</strong></span> must be used with NSS winbind.
253         Creation and administration of the local groups is done best via the Windows Domain User Manager or its
254         Samba equivalent, the utility <span><strong class="command">net rpc group</strong></span>. Creating the local group
255         <code class="constant">demo</code> is achieved by executing:
256         </p><pre class="screen">
257         <code class="prompt">root# </code> net rpc group add demo -L -Uroot%not24get
258         </pre><p>
259 <a class="indexterm" name="id2564909"></a>
260 <a class="indexterm" name="id2564916"></a>
261         Here the -L switch means that you want to create a local group. It may be necessary to add -S and -U
262         switches for accessing the correct host with appropriate user or root privileges. Adding and removing
263         group members can be done via the <code class="constant">addmem</code> and <code class="constant">delmem</code> subcommands of
264         <span><strong class="command">net rpc group</strong></span> command. For example, addition of &#8220;<span class="quote">DOM\Domain Users</span>&#8221; to the
265         local group <code class="constant">demo</code> is done by executing:
266         </p><pre class="screen">
267         net rpc group addmem demo "DOM\Domain Users"
268         </pre><p>
269 <a class="indexterm" name="id2564955"></a>
270 <a class="indexterm" name="id2564962"></a>
271 <a class="indexterm" name="id2564969"></a>
272 <a class="indexterm" name="id2564976"></a>
273         Having completed these two steps, the execution of <span><strong class="command">getent group demo</strong></span> will show demo
274         members of the global <code class="constant">Domain Users</code> group as members of  the group
275         <code class="constant">demo</code>.  This also works with any local or domain user. In case the domain DOM trusts
276         another domain, it is also possible to add global users and groups of the trusted domain as members of
277         <code class="constant">demo</code>. The users from the foreign domain who are members of the group that has been
278         added to the <code class="constant">demo</code> group now have the same local access permissions as local domain
279         users have. 
280         </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2565014"></a>Important Administrative Information</h3></div></div></div><p>
281         Administrative rights are necessary in two specific forms:
282         </p><div class="orderedlist"><ol type="1"><li><p>For Samba-3 domain controllers and domain member servers/clients.</p></li><li><p>To manage domain member Windows workstations.</p></li></ol></div><p>
283 <a class="indexterm" name="id2565045"></a>
284 <a class="indexterm" name="id2565052"></a>
285 <a class="indexterm" name="id2565059"></a>
286         Versions of Samba up to and including 3.0.10 do not provide a means for assigning rights and privileges
287         that are necessary for system administration tasks from a Windows domain member client machine, so
288         domain administration tasks such as adding, deleting, and changing user and group account information, and
289         managing workstation domain membership accounts, can be handled by any account other than root.
290         </p><p>
291 <a class="indexterm" name="id2565076"></a>
292 <a class="indexterm" name="id2565084"></a>
293 <a class="indexterm" name="id2565090"></a>
294         Samba-3.0.11 introduced a new privilege management interface (see <a href="rights.html" title="Chapter 14. User Rights and Privileges">User Rights and Privileges</a>)
295         that permits these tasks to be delegated to non-root (i.e., accounts other than the equivalent of the
296         MS Windows Administrator) accounts.
297         </p><p>
298 <a class="indexterm" name="id2565112"></a>
299 <a class="indexterm" name="id2565118"></a>
300         Administrative tasks on a Windows domain member workstation can be done by anyone who is a member of the
301         <code class="constant">Domain Admins</code> group. This group can be mapped to any convenient UNIX group.
302         </p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2565133"></a>Applicable Only to Versions Earlier than 3.0.11</h4></div></div></div><p>
303 <a class="indexterm" name="id2565141"></a>
304         Administrative tasks on UNIX/Linux systems, such as adding users or groups, requires
305         <code class="constant">root</code>-level privilege. The addition of a Windows client to a Samba domain involves the
306         addition of a user account for the Windows client.
307         </p><p>
308 <a class="indexterm" name="id2565159"></a>
309 <a class="indexterm" name="id2565166"></a>
310         Many UNIX administrators continue to request that the Samba Team make it possible to add Windows workstations, or 
311         the ability to add, delete, or modify user accounts, without requiring <code class="constant">root</code> privileges. 
312         Such a request violates every understanding of basic UNIX system security.
313         </p><p>
314 <a class="indexterm" name="id2565184"></a>
315 <a class="indexterm" name="id2565191"></a>
316 <a class="indexterm" name="id2565198"></a>
317 <a class="indexterm" name="id2565205"></a>
318 <a class="indexterm" name="id2565212"></a>
319 <a class="indexterm" name="id2565219"></a>
320         There is no safe way to provide access on a UNIX/Linux system without providing
321         <code class="constant">root</code>-level privileges. Provision of <code class="constant">root</code> privileges can be done
322         either by logging on to the Domain as the user <code class="constant">root</code> or by permitting particular users to
323         use a UNIX account that has a UID=0 in the <code class="filename">/etc/passwd</code> database. Users of such accounts
324         can use tools like the NT4 Domain User Manager and the NT4 Domain Server Manager to manage user and group
325         accounts as well as domain member server and client accounts. This level of privilege is also needed to manage
326         share-level ACLs.
327         </p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2565255"></a>Default Users, Groups, and Relative Identifiers</h3></div></div></div><p>
328         <a class="indexterm" name="id2565263"></a>
329         <a class="indexterm" name="id2565272"></a>
330 <a class="indexterm" name="id2565279"></a>
331 <a class="indexterm" name="id2565286"></a>
332 <a class="indexterm" name="id2565292"></a>
333 <a class="indexterm" name="id2565299"></a>
334 <a class="indexterm" name="id2565306"></a>
335 <a class="indexterm" name="id2565313"></a>
336         When first installed, Windows NT4/200x/XP are preconfigured with certain user, group, and
337         alias entities. Each has a well-known RID. These must be preserved for continued
338         integrity of operation. Samba must be provisioned with certain essential domain groups that require
339         the appropriate RID value. When Samba-3 is configured to use <code class="constant">tdbsam</code>, the essential
340         domain groups are automatically created. It is the LDAP administrator's responsibility to create
341         (provision) the default NT groups.
342         </p><p>
343 <a class="indexterm" name="id2565335"></a>
344 <a class="indexterm" name="id2565342"></a>
345 <a class="indexterm" name="id2565349"></a>
346 <a class="indexterm" name="id2565356"></a>
347         Each essential domain group must be assigned its respective well-known RID. The default users, groups,
348         aliases, and RIDs are shown in <a href="groupmapping.html#WKURIDS" title="Table 11.1. Well-Known User Default RIDs">Well-Known User Default RIDs</a>.
349         </p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
350 <a class="indexterm" name="id2565377"></a>
351 <a class="indexterm" name="id2565384"></a>
352 <a class="indexterm" name="id2565391"></a>
353 <a class="indexterm" name="id2565397"></a>
354 <a class="indexterm" name="id2565404"></a>
355         When the <em class="parameter"><code>passdb backend</code></em> uses LDAP (<code class="constant">ldapsam</code>), it is the
356         administrator's responsibility to create the essential domain groups and to assign each its default RID.
357         </p></div><p>
358 <a class="indexterm" name="id2565426"></a>
359 <a class="indexterm" name="id2565433"></a>
360         It is permissible to create any domain group that may be necessary; just make certain that the essential
361         domain groups (well known) have been created and assigned their default RIDs. Other groups you create may
362         be assigned any arbitrary RID you care to use.
363         </p><p>
364         Be sure to map each domain group to a UNIX system group. That is the only way to ensure that the group
365         will be available for use as an NT domain group.
366         </p><p>
367         </p><div class="table"><a name="WKURIDS"></a><p class="title"><b>Table 11.1. Well-Known User Default RIDs</b></p><table summary="Well-Known User Default RIDs" border="1"><colgroup><col align="left"><col align="left"><col align="left"><col align="center"></colgroup><thead><tr><th align="left">Well-Known Entity</th><th align="left">RID</th><th align="left">Type</th><th align="left">Essential</th></tr></thead><tbody><tr><td align="left">Domain Administrator</td><td align="left">500</td><td align="left">User</td><td align="left">No</td></tr><tr><td align="left">Domain Guest</td><td align="left">501</td><td align="left">User</td><td align="left">No</td></tr><tr><td align="left">Domain KRBTGT</td><td align="left">502</td><td align="left">User</td><td align="left">No</td></tr><tr><td align="left">Domain Admins</td><td align="left">512</td><td align="left">Group</td><td align="left">Yes</td></tr><tr><td align="left">Domain Users</td><td align="left">513</td><td align="left">Group</td><td align="left">Yes</td></tr><tr><td align="left">Domain Guests</td><td align="left">514</td><td align="left">Group</td><td align="left">Yes</td></tr><tr><td align="left">Domain Computers</td><td align="left">515</td><td align="left">Group</td><td align="left">No</td></tr><tr><td align="left">Domain Controllers</td><td align="left">516</td><td align="left">Group</td><td align="left">No</td></tr><tr><td align="left">Domain Certificate Admins</td><td align="left">517</td><td align="left">Group</td><td align="left">No</td></tr><tr><td align="left">Domain Schema Admins</td><td align="left">518</td><td align="left">Group</td><td align="left">No</td></tr><tr><td align="left">Domain Enterprise Admins</td><td align="left">519</td><td align="left">Group</td><td align="left">No</td></tr><tr><td align="left">Domain Policy Admins</td><td align="left">520</td><td align="left">Group</td><td align="left">No</td></tr><tr><td align="left">Builtin Admins</td><td align="left">544</td><td align="left">Alias</td><td align="left">No</td></tr><tr><td align="left">Builtin users</td><td align="left">545</td><td align="left">Alias</td><td align="left">No</td></tr><tr><td align="left">Builtin Guests</td><td align="left">546</td><td align="left">Alias</td><td align="left">No</td></tr><tr><td align="left">Builtin Power Users</td><td align="left">547</td><td align="left">Alias</td><td align="left">No</td></tr><tr><td align="left">Builtin Account Operators</td><td align="left">548</td><td align="left">Alias</td><td align="left">No</td></tr><tr><td align="left">Builtin System Operators</td><td align="left">549</td><td align="left">Alias</td><td align="left">No</td></tr><tr><td align="left">Builtin Print Operators</td><td align="left">550</td><td align="left">Alias</td><td align="left">No</td></tr><tr><td align="left">Builtin Backup Operators</td><td align="left">551</td><td align="left">Alias</td><td align="left">No</td></tr><tr><td align="left">Builtin Replicator</td><td align="left">552</td><td align="left">Alias</td><td align="left">No</td></tr><tr><td align="left">Builtin RAS Servers</td><td align="left">553</td><td align="left">Alias</td><td align="left">No</td></tr></tbody></table></div><p>
368         </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2565888"></a>Example Configuration</h3></div></div></div><p>
369 <a class="indexterm" name="id2565896"></a>
370                 You can list the various groups in the mapping database by executing
371                 <span><strong class="command">net groupmap list</strong></span>. Here is an example:
372                 </p><p>
373 <a class="indexterm" name="id2565918"></a>
374 </p><pre class="screen">
375 <code class="prompt">root# </code> <strong class="userinput"><code>net groupmap list</code></strong>
376 Domain Admins (S-1-5-21-2547222302-1596225915-2414751004-512) -&gt; domadmin
377 Domain Users (S-1-5-21-2547222302-1596225915-2414751004-513) -&gt; domuser
378 Domain Guests (S-1-5-21-2547222302-1596225915-2414751004-514) -&gt; domguest
379 </pre><p>
380                 </p><p>
381                 For complete details on <span><strong class="command">net groupmap</strong></span>, refer to the net(8) man page.
382                 </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2565964"></a>Configuration Scripts</h2></div></div></div><p>
383         Everyone needs tools. Some of us like to create our own, others prefer to use canned tools
384         (i.e., prepared by someone else for general use). 
385         </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2565976"></a>Sample <code class="filename">smb.conf</code> Add Group Script</h3></div></div></div><p>
386                 <a class="indexterm" name="id2565990"></a>
387                 <a class="indexterm" name="id2565997"></a>
388                 <a class="indexterm" name="id2566004"></a>
389 <a class="indexterm" name="id2566011"></a>
390 <a class="indexterm" name="id2566018"></a>
391                 A script to create complying group names for use by the Samba group interfaces
392                 is provided in <a href="groupmapping.html#smbgrpadd.sh" title="Example 11.1. smbgrpadd.sh">smbgrpadd.sh</a>. This script
393                 adds a temporary entry in the <code class="filename">/etc/group</code> file and then renames
394                 it to the desired name. This is an example of a method to get around operating
395                 system maintenance tool limitations such as those present in some version of the
396                 <span><strong class="command">groupadd</strong></span> tool.
397 </p><div class="example"><a name="smbgrpadd.sh"></a><p class="title"><b>Example 11.1. smbgrpadd.sh</b></p><pre class="programlisting">
398 #!/bin/bash
399
400 # Add the group using normal system groupadd tool.
401 groupadd smbtmpgrp00
402
403 thegid=`cat /etc/group | grep ^smbtmpgrp00 | cut -d ":" -f3`
404
405 # Now change the name to what we want for the MS Windows networking end
406 cp /etc/group /etc/group.bak
407 cat /etc/group.bak | sed "s/^smbtmpgrp00/$1/g" &gt; /etc/group
408 rm /etc/group.bak
409
410 # Now return the GID as would normally happen.
411 echo $thegid
412 exit 0
413 </pre></div><p>
414 </p><p>
415                 The <code class="filename">smb.conf</code> entry for the above script shown in <a href="groupmapping.html#smbgrpadd" title="Example 11.2. Configuration of smb.conf for the add group Script">the configuration of
416                 <code class="filename">smb.conf</code> for the add group Script</a> demonstrates how it may be used.
417
418 </p><div class="example"><a name="smbgrpadd"></a><p class="title"><b>Example 11.2. Configuration of <code class="filename">smb.conf</code> for the add group Script</b></p><table class="simplelist" border="0" summary="Simple list"><tr><td> </td></tr><tr><td><em class="parameter"><code>[global]</code></em></td></tr><tr><td><a class="indexterm" name="id2566132"></a><em class="parameter"><code>add group script = /path_to_tool/smbgrpadd.sh "%g"</code></em></td></tr></table></div><p>
419                 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2566149"></a>Script to Configure Group Mapping</h3></div></div></div><p>
420 <a class="indexterm" name="id2566157"></a>
421         In our example we have created a UNIX/Linux group called <code class="literal">ntadmin</code>.
422         Our script will create the additional groups <code class="literal">Orks</code>, <code class="literal">Elves</code>, and <code class="literal">Gnomes</code>.
423         It is a good idea to save this shell script for later use just in case you ever need to rebuild your mapping database.
424         For the sake of convenience we elect to save this script as a file called <code class="filename">initGroups.sh</code>.
425         This script is given in <a href="groupmapping.html#set-group-map" title="Example 11.3. Script to Set Group Mapping">intGroups.sh</a>.
426 <a class="indexterm" name="id2566208"></a>
427 </p><div class="example"><a name="set-group-map"></a><p class="title"><b>Example 11.3. Script to Set Group Mapping</b></p><pre class="programlisting">
428 #!/bin/bash
429
430 net groupmap modify ntgroup="Domain Admins" unixgroup=ntadmin
431 net groupmap modify ntgroup="Domain Users" unixgroup=users
432 net groupmap modify ntgroup="Domain Guests" unixgroup=nobody
433
434 groupadd Orks
435 groupadd Elves
436 groupadd Gnomes
437
438 net groupmap add ntgroup="Orks"   unixgroup=Orks   type=d
439 net groupmap add ntgroup="Elves"  unixgroup=Elves  type=d
440 net groupmap add ntgroup="Gnomes" unixgroup=Gnomes type=d
441 </pre></div><p>
442         </p><p>
443         Of course it is expected that the administrator will modify this to suit local needs.
444         For information regarding the use of the <span><strong class="command">net groupmap</strong></span> tool please
445         refer to the man page.
446         </p></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2566253"></a>Common Errors</h2></div></div></div><p>
447 At this time there are many little surprises for the unwary administrator. In a real sense
448 it is imperative that every step of automated control scripts be carefully tested
449 manually before putting it into active service.
450 </p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2566266"></a>Adding Groups Fails</h3></div></div></div><p>
451 <a class="indexterm" name="id2566274"></a>
452                 This is a common problem when the <span><strong class="command">groupadd</strong></span> is called directly
453                 by the Samba interface script for the <a class="indexterm" name="id2566288"></a>add group script in
454                 the <code class="filename">smb.conf</code> file.
455                 </p><p>
456 <a class="indexterm" name="id2566305"></a>
457 <a class="indexterm" name="id2566312"></a>
458                 The most common cause of failure is an attempt to add an MS Windows group account
459                 that has an uppercase character and/or a space character in it.
460                 </p><p>
461 <a class="indexterm" name="id2566325"></a>
462                 There are three possible workarounds. First, use only group names that comply
463                 with the limitations of the UNIX/Linux <span><strong class="command">groupadd</strong></span> system tool.
464                 Second, it involves the use of the script mentioned earlier in this chapter, and
465                 third is the option is to manually create a UNIX/Linux group account that can substitute
466                 for the MS Windows group name, then use the procedure listed above to map that group
467                 to the MS Windows group.
468                 </p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2566347"></a>Adding Domain Users to the Workstation Power Users Group</h3></div></div></div><p>&#8220;<span class="quote">
469                 What must I do to add domain users to the Power Users group?
470                 </span>&#8221;</p><p>
471 <a class="indexterm" name="id2566361"></a>
472                 The Power Users group is a group that is local to each Windows 200x/XP Professional workstation.
473                 You cannot add the Domain Users group to the Power Users group automatically, it must be done on
474                 each workstation by logging in as the local workstation <span class="emphasis"><em>administrator</em></span> and
475                 then using the following procedure:
476                 </p><div class="procedure"><ol type="1"><li><p>
477                         Click <span class="guimenu">Start -&gt; Control Panel -&gt; Users and Passwords</span>.
478                         </p></li><li><p>
479                         Click the <span class="guimenuitem">Advanced</span> tab.
480                         </p></li><li><p>
481                         Click the <span class="guibutton">Advanced</span> button.
482                         </p></li><li><p>
483                         Click <code class="constant">Groups</code>.
484                         </p></li><li><p>
485                         Double-click <code class="constant">Power Users</code>. This will launch the panel to add users or groups
486                         to the local machine <code class="constant">Power Users</code> group.
487                         </p></li><li><p>
488                         Click the <span class="guibutton">Add</span> button.
489                         </p></li><li><p>
490                         Select the domain from which the <code class="constant">Domain Users</code> group is to be added.
491                         </p></li><li><p>
492                         Double-click the <code class="constant">Domain Users</code> group.
493                         </p></li><li><p>
494                         Click the <span class="guibutton">OK</span> button. If a logon box is presented during this process, 
495                         please remember to enter the connect as <code class="constant">DOMAIN\UserName</code>, that is, for the
496                         domain <code class="constant">MIDEARTH</code> and the user <code class="constant">root</code> enter
497                         <code class="constant">MIDEARTH\root</code>.
498                         </p></li></ol></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="passdb.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="optional.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="NetCommand.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 10. Account Information Databases </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 12. Remote and Local Management: The Net Command</td></tr></table></div></body></html>