1 <?xml version="1.0" encoding="iso8859-1"?>
2 <chapter id="groupmapping">
5 <firstname>Jean François</firstname><surname>Micouleau</surname>
10 <title>Mapping MS Windows and Unix Groups</title>
13 Starting with Samba-3, new group mapping functionality is available to create associations
14 between Windows group SIDs and UNIX groups. The <parameter>groupmap</parameter> subcommand
15 included with the &net; tool can be used to manage these associations.
20 The first immediate reason to use the group mapping on a Samba PDC, is that
21 the <parameter>domain admin group</parameter> has been removed and should no longer
22 be specified in &smb.conf;. This parameter was used to give the listed users membership
23 in the <constant>Domain Admins</constant> Windows group which gave local admin rights on their workstations
24 (in default configurations).
29 <title>Features and Benefits</title>
32 Samba allows the administrator to create MS Windows NT4 / 200x group accounts and to
33 arbitrarily associate them with Unix/Linux group accounts.
37 Group accounts can be managed using the MS Windows NT4 or MS Windows 200x MMC tools
38 so long as appropriate interface scripts have been provided to &smb.conf;
42 Administrators should be aware that where &smb.conf; group interface scripts make
43 direct calls to the Unix/Linux system tools (eg: the shadow utilities, <command>groupadd</command>,
44 <command>groupdel</command>, <command>groupmod</command>) then the resulting Unix/Linux group names will be subject
45 to any limits imposed by these tools. If the tool does NOT allow upper case characters
46 or space characters, then the creation of an MS Windows NT4 / 200x style group of
47 <parameter>Engineering Managers</parameter> will attempt to create an identically named
48 Unix/Linux group, an attempt that will of course fail!
52 There are several possible work-arounds for the operating system tools limitation. One
53 method is to use a script that generates a name for the Unix/Linux system group that
54 fits the operating system limits, and that then just passes the Unix/Linux group id (GID)
55 back to the calling samba interface. This will provide a dynamic work-around solution.
59 Another work-around is to manually create a Unix/Linux group, then manually create the
60 MS Windows NT4 / 200x group on the Samba server and then use the <command>net groupmap</command>
61 tool to connect the two to each other.
67 <title>Discussion</title>
70 When installing <application>MS Windows NT4 / 200x</application> on a computer, the installation
71 program creates default users and groups. Notably the <constant>Administrators</constant> group,
72 and gives to that group privileges necessary privilidges to perform essential system tasks.
73 eg: Ability to change the date and time or to kill any process (or close too) running on the
78 The 'Administrator' user is a member of the 'Administrators' group, and thus inherits
79 'Administrators' group privileges. If a 'joe' user is created to be a member of the
80 'Administrator' group, 'joe' has exactly the same rights as 'Administrator'.
84 When an MS Windows NT4 / W200x is made a domain member, the "Domain Adminis" group of the
85 PDC is added to the local 'Administrators' group of the workstation. Every member of the
86 'Domain Administrators' group inherits the rights of the local 'Administrators' group when
87 logging on the workstation.
91 The following steps describe how to make samba PDC users members of the 'Domain Admins' group?
96 create a unix group (usually in <filename>/etc/group</filename>), let's call it domadm
99 <listitem><para>add to this group the users that must be Administrators. For example
100 if you want joe,john and mary, your entry in <filename>/etc/group</filename> will
104 <para><programlisting>
105 domadm:x:502:joe,john,mary
110 Map this domadm group to the "Domain Admins" group by running the command:
115 &rootprompt;<userinput>net groupmap add ntgroup="Domain Admins" unixgroup=domadm</userinput>
120 The quotes around "Domain Admins" are necessary due to the space in the group name.
121 Also make sure to leave no whitespace surrounding the equal character (=).
126 Now joe, john and mary are domain administrators!
130 It is possible to map any arbitrary UNIX group to any Windows NT4 / 200x group as well as
131 making any UNIX group a Windows domain group. For example, if you wanted to include a
132 UNIX group (e.g. acct) in a ACL on a local file or printer on a domain member machine,
133 you would flag that group as a domain group by running the following on the Samba PDC:
138 &rootprompt;<userinput>net groupmap add rid=1000 ntgroup="Accounting" unixgroup=acct</userinput>
143 Be aware that the RID parmeter is a unsigned 32 bit integer that should
144 normally start at 1000. However, this rid must not overlap with any RID assigned
145 to a user. Verifying this is done differently depending on on the passdb backend
146 you are using. Future versions of the tools may perform the verification automatically,
147 but for now the burden is on you.
151 <title>Example Configuration</title>
154 You can list the various groups in the mapping database by executing
155 <command>net groupmap list</command>. Here is an example:
160 &rootprompt; <userinput>net groupmap list</userinput>
161 System Administrators (S-1-5-21-2547222302-1596225915-2414751004-1002) -> sysadmin
162 Domain Admins (S-1-5-21-2547222302-1596225915-2414751004-512) -> domadmin
163 Domain Users (S-1-5-21-2547222302-1596225915-2414751004-513) -> domuser
164 Domain Guests (S-1-5-21-2547222302-1596225915-2414751004-514) -> domguest
169 For complete details on <command>net groupmap</command>, refer to the net(8) man page.
177 <title>Configuration Scripts</title>
180 Everyone needs tools. Some of us like to create our own, others prefer to use canned tools
181 (ie: prepared by someone else for general use).
185 <title>Sample &smb.conf; add group script</title>
188 A script to great complying group names for use by the samba group interfaces:
193 <title>smbgrpadd.sh</title>
198 # Add the group using normal system groupadd tool.
201 thegid=`cat /etc/group | grep smbtmpgrp00 | cut -d ":" -f3`
203 # Now change the name to what we want for the MS Windows networking end
204 cat /etc/group | sed s/smbtmpgrp00/$1/g > /etc/group
206 # Now return the GID as would normally happen.
214 The &smb.conf; entry for the above script would look like:
216 add group script = /path_to_tool/smbgrpadd.sh %g
223 <title>Script to configure Group Mapping</title>
226 In our example we have created a Unix/Linux group called <parameter>ntadmin</parameter>.
227 Our script will create the additional groups <parameter>Engineers, Marketoids, Gnomes</parameter>:
234 net groupmap modify ntgroup="Domain Admins" unixgroup=ntadmin
235 net groupmap modify ntgroup="Domain Users" unixgroup=users
236 net groupmap modify ntgroup="Domain Guests" unixgroup=nobody
237 net groupmap modify ntgroup="Administrators" unixgroup=root
238 net groupmap modify ntgroup="Users" unixgroup=users
239 net groupmap modify ntgroup="Guests" unixgroup=nobody
240 net groupmap modify ntgroup="System Operators" unixgroup=sys
241 net groupmap modify ntgroup="Account Operators" unixgroup=root
242 net groupmap modify ntgroup="Backup Operators" unixgroup=bin
243 net groupmap modify ntgroup="Print Operators" unixgroup=lp
244 net groupmap modify ntgroup="Replicators" unixgroup=daemon
245 net groupmap modify ntgroup="Power Users" unixgroup=sys
251 #net groupmap add ntgroup="Engineers" unixgroup=Engineers type=d
252 #net groupmap add ntgroup="Marketoids" unixgroup=Marketoids type=d
253 #net groupmap add ntgroup="Gnomes" unixgroup=Gnomes type=d
258 Of course it is expected that the admininstrator will modify this to suit local needs.
259 For information regarding the use of the <command>net groupmap</command> tool please
260 refer to the man page.
268 <title>Common Errors</title>
271 At this time there are many little surprises for the unwary administrator. In a real sense
272 it is imperative that every step of automated control scripts must be carefully tested
273 manually before putting them into active service.
277 <title>Adding Groups Fails</title>
280 This is a common problem when the <command>groupadd</command> is called directly
281 by the samba interface script for the <parameter>add group script</parameter> in
286 The most common cause of failure is an attempt to add an MS Windows group acocunt
287 that has either an upper case character and/or a space character in it.
291 There are three possible work-arounds. Firstly, use only group names that comply
292 with the limitations of the Unix/Linux <command>groupadd</command> system tool.
293 The second involves use of the script mentioned earlier in this chapter, and the
294 third option is to manually create a Unix/Linux group account that can substitute
295 for the MS Windows group name, then use the procedure listed above to map that group
296 to the MS Windows group.
302 <title>Adding MS Windows Groups to MS Windows Groups Fails</title>
305 Samba-3 does NOT support nested groups from the MS Windows control environment.