1
<?xml version="1.0" encoding="iso-8859-1"?>
2
<!DOCTYPE chapter PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3
<chapter id="groupmapping">
7
<firstname>Jean Fran�ois</firstname><surname>Micouleau</surname>
11
<title>Group Mapping: MS Windows and UNIX</title>
15
<indexterm significance="preferred"><primary>groups</primary><secondary>mapping</secondary></indexterm>
16
<indexterm><primary>SID</primary></indexterm>
17
<indexterm><primary>associations</primary></indexterm>
18
<indexterm><primary>UNIX groups</primary></indexterm>
19
<indexterm><primary>groupmap</primary></indexterm>
20
<indexterm><primary>net</primary></indexterm>
21
Starting with Samba-3, new group mapping functionality is available to create associations
22
between Windows group SIDs and UNIX group GIDs. The <command>groupmap</command> subcommand
23
included with the &net; tool can be used to manage these associations.
27
<indexterm><primary>group mapping</primary></indexterm>
28
<indexterm><primary>domain groups</primary></indexterm>
29
The new facility for mapping NT groups to UNIX system groups allows the administrator to decide
30
which NT domain groups are to be exposed to MS Windows clients. Only those NT groups that map
31
to a UNIX group that has a value other than the default (<constant>-1</constant>) will be exposed
32
in group selection lists in tools that access domain users and groups.
37
<indexterm><primary>domain admin group</primary></indexterm>
38
<indexterm><primary>Windows group</primary></indexterm>
39
The <parameter>domain admin group</parameter> parameter has been removed in Samba-3 and should no longer
40
be specified in &smb.conf;. In Samba-2.2.x, this parameter was used to give the listed users membership in the
41
<constant>Domain Admins</constant> Windows group, which gave local admin rights on their workstations
42
(in default configurations).
47
<title>Features and Benefits</title>
50
Samba allows the administrator to create MS Windows NT4/200x group accounts and to
51
arbitrarily associate them with UNIX/Linux group accounts.
55
<indexterm><primary>UID</primary></indexterm>
56
<indexterm><primary>GID</primary></indexterm>
57
<indexterm><primary>idmap uid</primary></indexterm>
58
<indexterm><primary>MMC</primary></indexterm>
59
<indexterm><primary>winbindd</primary></indexterm>
60
<indexterm><primary>ID range</primary></indexterm>
61
<indexterm><primary>group accounts</primary></indexterm>
62
Group accounts can be managed using the MS Windows NT4 or MS Windows 200x/XP Professional MMC tools.
63
Appropriate interface scripts should be provided in &smb.conf; if it is desired that UNIX/Linux system
64
accounts should be automatically created when these tools are used. In the absence of these scripts, and
65
so long as <command>winbindd</command> is running, Samba group accounts that are created using these
66
tools will be allocated UNIX UIDs and GIDs from the ID range specified by the
67
<smbconfoption name="idmap uid"/>/<smbconfoption name="idmap gid"/>
68
parameters in the &smb.conf; file.
71
<figure id="idmap-sid2gid">
72
<title>IDMAP: Group SID-to-GID Resolution.</title>
73
<imagefile scale="50">idmap-sid2gid</imagefile>
76
<figure id="idmap-gid2sid">
77
<title>IDMAP: GID Resolution to Matching SID.</title>
78
<imagefile scale="50">idmap-gid2sid</imagefile>
82
<indexterm><primary>IDMAP</primary></indexterm>
83
<indexterm><primary>SID-to-GID</primary></indexterm>
84
<indexterm><primary>net</primary><secondary>groupmap</secondary></indexterm>
85
<indexterm><primary>group mappings</primary></indexterm>
86
In both cases, when winbindd is not running, only locally resolvable groups can be recognized. Please refer to
87
<link linkend="idmap-sid2gid">IDMAP: Group SID-to-GID Resolution</link> and <link
88
linkend="idmap-gid2sid">IDMAP: GID Resolution to Matching SID</link>. The <command>net groupmap</command> is
89
used to establish UNIX group to NT SID mappings as shown in <link linkend="idmap-store-gid2sid">IDMAP: storing
90
group mappings</link>.
93
<figure id="idmap-store-gid2sid">
94
<title>IDMAP Storing Group Mappings.</title>
95
<imagefile scale="50">idmap-store-gid2sid</imagefile>
99
<indexterm><primary>groupadd</primary></indexterm>
100
<indexterm><primary>groupdel</primary></indexterm>
101
<indexterm><primary>shadow utilities</primary></indexterm>
102
<indexterm><primary>groupmod</primary></indexterm>
103
Administrators should be aware that where &smb.conf; group interface scripts make
104
direct calls to the UNIX/Linux system tools (the shadow utilities, <command>groupadd</command>,
105
<command>groupdel</command>, and <command>groupmod</command>), the resulting UNIX/Linux group names will be subject
106
to any limits imposed by these tools. If the tool does not allow uppercase characters
107
or space characters, then the creation of an MS Windows NT4/200x-style group of
108
<literal>Engineering Managers</literal> will attempt to create an identically named
109
UNIX/Linux group, an attempt that will of course fail.
113
<indexterm><primary>GID</primary></indexterm>
114
<indexterm><primary>SID</primary></indexterm>
115
There are several possible workarounds for the operating system tools limitation. One
116
method is to use a script that generates a name for the UNIX/Linux system group that
117
fits the operating system limits and that then just passes the UNIX/Linux group ID (GID)
118
back to the calling Samba interface. This will provide a dynamic workaround solution.
122
<indexterm><primary>net</primary><secondary>groupmap</secondary></indexterm>
123
Another workaround is to manually create a UNIX/Linux group, then manually create the
124
MS Windows NT4/200x group on the Samba server, and then use the <command>net groupmap</command>
125
tool to connect the two to each other.
131
<title>Discussion</title>
134
<indexterm><primary>Windows NT4/200x</primary></indexterm>
135
<indexterm><primary>group privileges</primary></indexterm>
136
When you install <application>MS Windows NT4/200x</application> on a computer, the installation
137
program creates default users and groups, notably the <constant>Administrators</constant> group,
138
and gives that group privileges necessary to perform essential system tasks,
139
such as the ability to change the date and time or to kill (or close) any process running on the
144
<indexterm><primary>Administrator</primary></indexterm>
145
The <constant>Administrator</constant> user is a member of the <constant>Administrators</constant> group, and thus inherits
146
<constant>Administrators</constant> group privileges. If a <constant>joe</constant> user is created to be a member of the
147
<constant>Administrators</constant> group, <constant>joe</constant> has exactly the same rights as the user
148
<constant>Administrator</constant>.
152
<indexterm><primary>domain member</primary></indexterm>
153
<indexterm><primary>Domain Admins</primary></indexterm>
154
<indexterm><primary>inherits rights</primary></indexterm>
155
<indexterm><primary>PDC</primary></indexterm>
156
When an MS Windows NT4/200x/XP machine is made a domain member, the <quote>Domain Admins</quote> group of the
157
PDC is added to the local <constant>Administrators</constant> group of the workstation. Every member of the
158
<constant>Domain Admins</constant> group inherits the rights of the local <constant>Administrators</constant> group when
159
logging on the workstation.
163
<indexterm><primary>Domain Admins</primary></indexterm>
164
<indexterm><primary>PDC</primary></indexterm>
165
The following steps describe how to make Samba PDC users members of the <constant>Domain Admins</constant> group.
170
Create a UNIX group (usually in <filename>/etc/group</filename>); let's call it <constant>domadm</constant>.
174
<indexterm><primary>/etc/group</primary></indexterm>
175
Add to this group the users that must be <quote>Administrators</quote>. For example,
176
if you want <constant>joe, john</constant>, and <constant>mary</constant> to be administrators,
177
your entry in <filename>/etc/group</filename> will look like this:
180
<para><programlisting>
181
domadm:x:502:joe,john,mary
186
Map this domadm group to the <quote>Domain Admins</quote> group by executing the command:
191
&rootprompt;<userinput>net groupmap add ntgroup="Domain Admins" unixgroup=domadm rid=512 type=d</userinput>
196
<indexterm><primary>Domain Admins group</primary></indexterm>
197
The quotes around <quote>Domain Admins</quote> are necessary due to the space in the group name.
198
Also make sure to leave no white space surrounding the equal character (=).
203
Now <constant>joe, john</constant>, and <constant>mary</constant> are domain administrators.
207
<indexterm><primary>groups</primary><secondary>domain</secondary></indexterm>
208
It is possible to map any arbitrary UNIX group to any Windows NT4/200x group as well as
209
to make any UNIX group a Windows domain group. For example, if you wanted to include a
210
UNIX group (e.g., acct) in an ACL on a local file or printer on a Domain Member machine,
211
you would flag that group as a domain group by running the following on the Samba PDC:
216
&rootprompt;<userinput>net groupmap add rid=1000 ntgroup="Accounting" unixgroup=acct type=d</userinput>
218
The <literal>ntgroup</literal> value must be in quotes if it contains space characters to prevent
219
the space from being interpreted as a command delimiter.
223
<indexterm><primary>RID</primary></indexterm>
224
<indexterm><primary>assigned RID</primary></indexterm>
225
Be aware that the RID parameter is an unsigned 32-bit integer that should
226
normally start at 1000. However, this RID must not overlap with any RID assigned
227
to a user. Verification for this is done differently depending on the passdb backend
228
you are using. Future versions of the tools may perform the verification automatically,
229
but for now the burden is on you.
233
<title>Warning: User Private Group Problems</title>
236
<indexterm><primary>group accounts</primary></indexterm>
237
<indexterm><primary>Red Hat Linux</primary></indexterm>
238
<indexterm><primary>private groups</primary></indexterm>
239
Windows does not permit user and group accounts to have the same name.
240
This has serious implications for all sites that use private group accounts.
241
A private group account is an administrative practice whereby users are each
242
given their own group account. Red Hat Linux, as well as several free distributions
243
of Linux, by default create private groups.
247
<indexterm><primary>UNIX/Linux group</primary></indexterm>
248
<indexterm><primary>Windows group</primary></indexterm>
249
When mapping a UNIX/Linux group to a Windows group account, all conflict can
250
be avoided by assuring that the Windows domain group name does not overlap
251
with any user account name.
257
<title>Nested Groups: Adding Windows Domain Groups to Windows Local Groups</title>
259
<indexterm><primary>groups</primary><secondary>nested</secondary></indexterm>
262
<indexterm><primary>nested groups</primary></indexterm>
263
This functionality is known as <constant>nested groups</constant> and was first added to
268
<indexterm><primary>nested groups</primary></indexterm>
269
All MS Windows products since the release of Windows NT 3.10 support the use of nested groups.
270
Many Windows network administrators depend on this capability because it greatly simplifies security
275
<indexterm><primary>nested group</primary></indexterm>
276
<indexterm><primary>group membership</primary></indexterm>
277
<indexterm><primary>domain security</primary></indexterm>
278
<indexterm><primary>domain member server</primary></indexterm>
279
<indexterm><primary>local groups</primary></indexterm>
280
<indexterm><primary>domain global groups</primary></indexterm>
281
<indexterm><primary>domain global users</primary></indexterm>
282
The nested group architecture was designed with the premise that day-to-day user and group membership
283
management should be performed on the domain security database. The application of group security
284
should be implemented on domain member servers using only local groups. On the domain member server,
285
all file system security controls are then limited to use of the local groups, which will contain
286
domain global groups and domain global users.
290
<indexterm><primary>individual domain user</primary></indexterm>
291
<indexterm><primary>domain group settings</primary></indexterm>
292
<indexterm><primary>Account Unknown</primary></indexterm>
293
You may ask, What are the benefits of this arrangement? The answer is obvious to those who have plumbed
294
the dark depths of Windows networking architecture. Consider for a moment a server on which are stored
295
200,000 files, each with individual domain user and domain group settings. The company that owns the
296
file server is bought by another company, resulting in the server being moved to another location, and then
297
it is made a member of a different domain. Who would you think now owns all the files and directories?
298
Answer: Account Unknown.
302
<indexterm><primary>directory access control</primary></indexterm>
303
<indexterm><primary>local groups</primary></indexterm>
304
<indexterm><primary>ACL</primary></indexterm>
305
<indexterm><primary>Account Unknown</primary></indexterm>
306
Unraveling the file ownership mess is an unenviable administrative task that can be avoided simply
307
by using local groups to control all file and directory access control. In this case, only the members
308
of the local groups will have been lost. The files and directories in the storage subsystem will still
309
be owned by the local groups. The same goes for all ACLs on them. It is administratively much simpler
310
to delete the <constant>Account Unknown</constant> membership entries inside local groups with appropriate
311
entries for domain global groups in the new domain that the server has been made a member of.
315
<indexterm><primary>nested groups</primary></indexterm>
316
<indexterm><primary>administrative privileges</primary></indexterm>
317
<indexterm><primary>domain member workstations</primary></indexterm>
318
<indexterm><primary>domain member servers</primary></indexterm>
319
<indexterm><primary>member machine</primary></indexterm>
320
<indexterm><primary>full rights</primary></indexterm>
321
<indexterm><primary>Domain Admins</primary></indexterm>
322
<indexterm><primary>local administrative privileges</primary></indexterm>
323
Another prominent example of the use of nested groups involves implementation of administrative privileges
324
on domain member workstations and servers. Administrative privileges are given to all members of the
325
built-in local group <constant>Administrators</constant> on each domain member machine. To ensure that all domain
326
administrators have full rights on the member server or workstation, on joining the domain, the
327
<constant>Domain Admins</constant> group is added to the local Administrators group. Thus everyone who is
328
logged into the domain as a member of the Domain Admins group is also granted local administrative
329
privileges on each domain member.
333
<indexterm><primary>nested groups</primary></indexterm>
334
<indexterm><primary>auxiliary members</primary></indexterm>
335
<indexterm><primary>/etc/group</primary></indexterm>
336
<indexterm><primary>winbind</primary></indexterm>
337
UNIX/Linux has no concept of support for nested groups, and thus Samba has for a long time not supported
338
them either. The problem is that you would have to enter UNIX groups as auxiliary members of a group in
339
<filename>/etc/group</filename>. This does not work because it was not a design requirement at the time
340
the UNIX file system security model was implemented. Since Samba-2.2, the winbind daemon can provide
341
<filename>/etc/group</filename> entries on demand by obtaining user and group information from the domain
342
controller that the Samba server is a member of.
346
<indexterm><primary>/etc/group</primary></indexterm>
347
<indexterm><primary>libnss_winbind</primary></indexterm>
348
<indexterm><primary>local groups</primary></indexterm>
349
<indexterm><primary>Domain Users</primary></indexterm>
350
<indexterm><primary>alias group</primary></indexterm>
351
In effect, Samba supplements the <filename>/etc/group</filename> data via the dynamic
352
<command>libnss_winbind</command> mechanism. Beginning with Samba-3.0.3, this facility is used to provide
353
local groups in the same manner as Windows. It works by expanding the local groups on the
354
fly as they are accessed. For example, the <constant>Domain Users</constant> group of the domain is made
355
a member of the local group <constant>demo</constant>. Whenever Samba needs to resolve membership of the
356
<constant>demo</constant> local (alias) group, winbind asks the domain controller for demo members of the Domain Users
357
group. By definition, it can only contain user objects, which can then be faked to be member of the
358
UNIX/Linux group <constant>demo</constant>.
362
<indexterm><primary>nested groups</primary></indexterm>
363
<indexterm><primary>winbindd</primary></indexterm>
364
<indexterm><primary>NSS</primary></indexterm>
365
<indexterm><primary>winbind</primary></indexterm>
366
<indexterm><primary>local groups</primary></indexterm>
367
<indexterm><primary>Domain User Manager</primary></indexterm>
368
<indexterm><primary>net</primary><secondary>rpc</secondary><tertiary>group</tertiary></indexterm>
369
To enable the use of nested groups, <command>winbindd</command> must be used with NSS winbind.
370
Creation and administration of the local groups is done best via the Windows Domain User Manager or its
371
Samba equivalent, the utility <command>net rpc group</command>. Creating the local group
372
<constant>demo</constant> is achieved by executing:
374
&rootprompt; net rpc group add demo -L -Uroot%not24get
376
<indexterm><primary>addmem</primary></indexterm>
377
<indexterm><primary>delmem</primary></indexterm>
378
Here the -L switch means that you want to create a local group. It may be necessary to add -S and -U
379
switches for accessing the correct host with appropriate user or root privileges. Adding and removing
380
group members can be done via the <constant>addmem</constant> and <constant>delmem</constant> subcommands of
381
<command>net rpc group</command> command. For example, addition of <quote>DOM\Domain Users</quote> to the
382
local group <constant>demo</constant> is done by executing:
384
net rpc group addmem demo "DOM\Domain Users"
386
<indexterm><primary>getent group demo</primary></indexterm>
387
<indexterm><primary>trusted domain</primary></indexterm>
388
<indexterm><primary>foreign domain</primary></indexterm>
389
<indexterm><primary>local access permissions</primary></indexterm>
390
Having completed these two steps, the execution of <command>getent group demo</command> will show demo
391
members of the global <constant>Domain Users</constant> group as members of the group
392
<constant>demo</constant>. This also works with any local or domain user. In case the domain DOM trusts
393
another domain, it is also possible to add global users and groups of the trusted domain as members of
394
<constant>demo</constant>. The users from the foreign domain who are members of the group that has been
395
added to the <constant>demo</constant> group now have the same local access permissions as local domain
402
<title>Important Administrative Information</title>
405
Administrative rights are necessary in two specific forms:
409
<listitem><para>For Samba-3 domain controllers and domain member servers/clients.</para></listitem>
410
<listitem><para>To manage domain member Windows workstations.</para></listitem>
414
<indexterm><primary>rights and privileges</primary></indexterm>
415
<indexterm><primary>domain member client</primary></indexterm>
416
<indexterm><primary>group account</primary></indexterm>
417
Versions of Samba up to and including 3.0.10 do not provide a means for assigning rights and privileges
418
that are necessary for system administration tasks from a Windows domain member client machine, so
419
domain administration tasks such as adding, deleting, and changing user and group account information, and
420
managing workstation domain membership accounts, can be handled by any account other than root.
424
<indexterm><primary>privilege management</primary></indexterm>
425
<indexterm><primary>delegated</primary></indexterm>
426
<indexterm><primary>Administrator</primary></indexterm>
427
Samba-3.0.11 introduced a new privilege management interface (see <link linkend="rights">User Rights and Privileges</link>)
428
that permits these tasks to be delegated to non-root (i.e., accounts other than the equivalent of the
429
MS Windows Administrator) accounts.
433
<indexterm><primary>mapped</primary></indexterm>
434
<indexterm><primary>Domain Admins</primary></indexterm>
435
Administrative tasks on a Windows domain member workstation can be done by anyone who is a member of the
436
<constant>Domain Admins</constant> group. This group can be mapped to any convenient UNIX group.
440
<title>Applicable Only to Versions Earlier than 3.0.11</title>
443
<indexterm><primary>privilege</primary></indexterm>
444
Administrative tasks on UNIX/Linux systems, such as adding users or groups, requires
445
<constant>root</constant>-level privilege. The addition of a Windows client to a Samba domain involves the
446
addition of a user account for the Windows client.
450
<indexterm><primary>system security</primary></indexterm>
451
<indexterm><primary>privileges</primary></indexterm>
452
Many UNIX administrators continue to request that the Samba Team make it possible to add Windows workstations, or
453
the ability to add, delete, or modify user accounts, without requiring <constant>root</constant> privileges.
454
Such a request violates every understanding of basic UNIX system security.
458
<indexterm><primary>privileges</primary></indexterm>
459
<indexterm><primary>/etc/passwd</primary></indexterm>
460
<indexterm><primary>Domain Server Manager</primary></indexterm>
461
<indexterm><primary>Domain User Manager</primary></indexterm>
462
<indexterm><primary>manage share-level ACL</primary></indexterm>
463
<indexterm><primary>share-level ACLs</primary></indexterm>
464
There is no safe way to provide access on a UNIX/Linux system without providing
465
<constant>root</constant>-level privileges. Provision of <constant>root</constant> privileges can be done
466
either by logging on to the Domain as the user <constant>root</constant> or by permitting particular users to
467
use a UNIX account that has a UID=0 in the <filename>/etc/passwd</filename> database. Users of such accounts
468
can use tools like the NT4 Domain User Manager and the NT4 Domain Server Manager to manage user and group
469
accounts as well as domain member server and client accounts. This level of privilege is also needed to manage
478
<title>Default Users, Groups, and Relative Identifiers</title>
481
<indexterm><primary>Relative Identifier</primary><see>RID</see></indexterm>
482
<indexterm><primary>RID</primary></indexterm>
483
<indexterm><primary>Windows NT4/200x/XP</primary></indexterm>
484
<indexterm><primary>well-known RID</primary></indexterm>
485
<indexterm><primary>domain groups</primary></indexterm>
486
<indexterm><primary>tdbsam</primary></indexterm>
487
<indexterm><primary>LDAP</primary></indexterm>
488
<indexterm><primary>NT groups</primary></indexterm>
489
When first installed, Windows NT4/200x/XP are preconfigured with certain user, group, and
490
alias entities. Each has a well-known RID. These must be preserved for continued
491
integrity of operation. Samba must be provisioned with certain essential domain groups that require
492
the appropriate RID value. When Samba-3 is configured to use <constant>tdbsam</constant>, the essential
493
domain groups are automatically created. It is the LDAP administrator's responsibility to create
494
(provision) the default NT groups.
498
<indexterm><primary>default users</primary></indexterm>
499
<indexterm><primary>default groups</primary></indexterm>
500
<indexterm><primary>default aliases</primary></indexterm>
501
<indexterm><primary>RID</primary></indexterm>
502
Each essential domain group must be assigned its respective well-known RID. The default users, groups,
503
aliases, and RIDs are shown in <link linkend="WKURIDS">Well-Known User Default RIDs</link>.
507
<indexterm><primary>passdb backend</primary></indexterm>
508
<indexterm><primary>LDAP</primary></indexterm>
509
<indexterm><primary>ldapsam</primary></indexterm>
510
<indexterm><primary>domain groups</primary></indexterm>
511
<indexterm><primary>RID</primary></indexterm>
512
It is the administrator's responsibility to create the essential domain groups and to assign each
517
<indexterm><primary>domain groups</primary></indexterm>
518
<indexterm><primary>RID</primary></indexterm>
519
It is permissible to create any domain group that may be necessary; just make certain that the essential
520
domain groups (well known) have been created and assigned their default RIDs. Other groups you create may
521
be assigned any arbitrary RID you care to use.
525
Be sure to map each domain group to a UNIX system group. That is the only way to ensure that the group
526
will be available for use as an NT domain group.
530
<table frame="all" id="WKURIDS">
531
<title>Well-Known User Default RIDs</title>
532
<tgroup cols="4" align="left">
533
<colspec align="left"/>
534
<colspec align="left"/>
535
<colspec align="left"/>
536
<colspec align="center"/>
539
<entry>Well-Known Entity</entry>
542
<entry>Essential</entry>
547
<entry>Domain Administrator</entry>
553
<entry>Domain Guest</entry>
559
<entry>Domain KRBTGT</entry>
565
<entry>Domain Admins</entry>
571
<entry>Domain Users</entry>
577
<entry>Domain Guests</entry>
583
<entry>Domain Computers</entry>
589
<entry>Domain Controllers</entry>
595
<entry>Domain Certificate Admins</entry>
601
<entry>Domain Schema Admins</entry>
607
<entry>Domain Enterprise Admins</entry>
613
<entry>Domain Policy Admins</entry>
619
<entry>Builtin Admins</entry>
625
<entry>Builtin users</entry>
631
<entry>Builtin Guests</entry>
637
<entry>Builtin Power Users</entry>
643
<entry>Builtin Account Operators</entry>
649
<entry>Builtin System Operators</entry>
655
<entry>Builtin Print Operators</entry>
661
<entry>Builtin Backup Operators</entry>
667
<entry>Builtin Replicator</entry>
673
<entry>Builtin RAS Servers</entry>
686
<title>Example Configuration</title>
689
<indexterm><primary>net</primary><secondary>groupmap</secondary><tertiary>list</tertiary></indexterm>
690
You can list the various groups in the mapping database by executing
691
<command>net groupmap list</command>. Here is an example:
695
<indexterm><primary>net</primary><secondary>groupmap</secondary></indexterm>
697
&rootprompt; <userinput>net groupmap list</userinput>
698
Domain Admins (S-1-5-21-2547222302-1596225915-2414751004-512) -> domadmin
699
Domain Users (S-1-5-21-2547222302-1596225915-2414751004-513) -> domuser
700
Domain Guests (S-1-5-21-2547222302-1596225915-2414751004-514) -> domguest
705
For complete details on <command>net groupmap</command>, refer to the net(8) man page.
713
<title>Configuration Scripts</title>
716
Everyone needs tools. Some of us like to create our own, others prefer to use canned tools
717
(i.e., prepared by someone else for general use).
721
<title>Sample &smb.conf; Add Group Script</title>
724
<indexterm><primary>smbgrpadd.sh</primary></indexterm>
725
<indexterm><primary>groupadd limitations</primary></indexterm>
726
<indexterm><primary>smbgrpadd.sh</primary></indexterm>
727
<indexterm><primary>/etc/group</primary></indexterm>
728
<indexterm><primary>groupadd</primary></indexterm>
729
A script to create complying group names for use by the Samba group interfaces
730
is provided in <link linkend="smbgrpadd.sh">smbgrpadd.sh</link>. This script
731
adds a temporary entry in the <filename>/etc/group</filename> file and then renames
732
it to the desired name. This is an example of a method to get around operating
733
system maintenance tool limitations such as those present in some version of the
734
<command>groupadd</command> tool.
735
<example id="smbgrpadd.sh">
736
<title>smbgrpadd.sh</title>
740
# Add the group using normal system groupadd tool.
743
thegid=`cat /etc/group | grep ^smbtmpgrp00 | cut -d ":" -f3`
745
# Now change the name to what we want for the MS Windows networking end
746
cp /etc/group /etc/group.bak
747
cat /etc/group.bak | sed "s/^smbtmpgrp00/$1/g" > /etc/group
750
# Now return the GID as would normally happen.
758
The &smb.conf; entry for the above script shown in <link linkend="smbgrpadd">the configuration of
759
&smb.conf; for the add group Script</link> demonstrates how it may be used.
761
<example id="smbgrpadd">
762
<title>Configuration of &smb.conf; for the add group Script</title>
764
<smbconfsection name="[global]"/>
765
<smbconfoption name="add group script">/path_to_tool/smbgrpadd.sh "%g"</smbconfoption>
773
<title>Script to Configure Group Mapping</title>
776
<indexterm><primary>initGroups.sh</primary></indexterm>
777
In our example we have created a UNIX/Linux group called <literal>ntadmin</literal>.
778
Our script will create the additional groups <literal>Orks</literal>, <literal>Elves</literal>, and <literal>Gnomes</literal>.
779
It is a good idea to save this shell script for later use just in case you ever need to rebuild your mapping database.
780
For the sake of convenience we elect to save this script as a file called <filename>initGroups.sh</filename>.
781
This script is given in <link linkend="set-group-map">intGroups.sh</link>.
782
<indexterm><primary>initGroups.sh</primary></indexterm>
783
<example id="set-group-map">
784
<title>Script to Set Group Mapping</title>
788
net groupmap add ntgroup="Domain Admins" unixgroup=ntadmin rid=512 type=d
789
net groupmap add ntgroup="Domain Users" unixgroup=users rid=513 type=d
790
net groupmap add ntgroup="Domain Guests" unixgroup=nobody rid=514 type=d
796
net groupmap add ntgroup="Orks" unixgroup=Orks type=d
797
net groupmap add ntgroup="Elves" unixgroup=Elves type=d
798
net groupmap add ntgroup="Gnomes" unixgroup=Gnomes type=d
804
Of course it is expected that the administrator will modify this to suit local needs.
805
For information regarding the use of the <command>net groupmap</command> tool please
806
refer to the man page.
810
Versions of Samba-3 prior to 3.0.23 automatically create default group mapping for the
811
<literal>Domain Admins, Domain Users</literal> and <literal>Domain Guests</literal> Windows
812
groups, but do not map them to UNIX GIDs. This was a cause of administrative confusion and
813
trouble. Commencing with Samba-3.0.23 this annomaly has been fixed - thus all Windows groups
814
must now be manually and explicitly created and mapped to a valid UNIX GID by the Samba
823
<title>Common Errors</title>
826
At this time there are many little surprises for the unwary administrator. In a real sense
827
it is imperative that every step of automated control scripts be carefully tested
828
manually before putting it into active service.
832
<title>Adding Groups Fails</title>
835
<indexterm><primary>groupadd</primary></indexterm>
836
This is a common problem when the <command>groupadd</command> is called directly
837
by the Samba interface script for the <smbconfoption name="add group script"/> in
842
<indexterm><primary>uppercase character</primary></indexterm>
843
<indexterm><primary>space character</primary></indexterm>
844
The most common cause of failure is an attempt to add an MS Windows group account
845
that has an uppercase character and/or a space character in it.
849
<indexterm><primary>groupadd</primary></indexterm>
850
There are three possible workarounds. First, use only group names that comply
851
with the limitations of the UNIX/Linux <command>groupadd</command> system tool.
852
Second, it involves the use of the script mentioned earlier in this chapter, and
853
third is the option is to manually create a UNIX/Linux group account that can substitute
854
for the MS Windows group name, then use the procedure listed above to map that group
855
to the MS Windows group.
861
<title>Adding Domain Users to the Workstation Power Users Group</title>
864
What must I do to add domain users to the Power Users group?
868
<indexterm><primary>Domain Users group</primary></indexterm>
869
The Power Users group is a group that is local to each Windows 200x/XP Professional workstation.
870
You cannot add the Domain Users group to the Power Users group automatically, it must be done on
871
each workstation by logging in as the local workstation <emphasis>administrator</emphasis> and
872
then using the following procedure:
877
Click <guimenu>Start -> Control Panel -> Users and Passwords</guimenu>.
881
Click the <guimenuitem>Advanced</guimenuitem> tab.
885
Click the <guibutton>Advanced</guibutton> button.
889
Click <constant>Groups</constant>.
893
Double-click <constant>Power Users</constant>. This will launch the panel to add users or groups
894
to the local machine <constant>Power Users</constant> group.
898
Click the <guibutton>Add</guibutton> button.
902
Select the domain from which the <constant>Domain Users</constant> group is to be added.
906
Double-click the <constant>Domain Users</constant> group.
910
Click the <guibutton>OK</guibutton> button. If a logon box is presented during this process,
911
please remember to enter the connect as <constant>DOMAIN\UserName</constant>, that is, for the
912
domain <constant>MIDEARTH</constant> and the user <constant>root</constant> enter
913
<constant>MIDEARTH\root</constant>.