Another update.
[Samba/gebeck_regimport.git] / docs / Samba3-HOWTO / TOSHARG-RightsAndPriviliges.xml
blobfec78b2ade572bc3bf4d33d5276d701962ea397d
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="rights">
4 <chapterinfo>
5         &author.jerry;
6         &author.jht;
7 </chapterinfo>
9 <title>User Rights and Privileges</title>
11 <para>
12 The administration of Windows user, group, and machine accounts in the Samba
13 domain-controlled network necessitates interfacing between the MS Windows
14 networking environment and the UNIX operating system environment. The right
15 (permission) to add machines to the Windows security domain can be assigned
16 (set) to non-administrative users both in Windows NT4 domains and
17 Active Directory domains.
18 </para>
20 <para>
21 The addition of Windows NT4/2kX/XPPro machines to the domain necessitates the
22 creation of a machine account for each machine added. The machine account is
23 a necessity that is used to validate that the machine can be trusted to permit
24 user logons.
25 </para>
27 <para>
28 Machine accounts are analogous to user accounts, and thus in implementing them on a UNIX machine that is
29 hosting Samba (i.e., on which Samba is running) it is necessary to create a special type of user account.
30 Machine accounts differ from a normal user account in that the account name (login ID) is terminated with a
31 <literal>$</literal> sign. An additional difference is that this type of account should not ever be able to
32 log into the UNIX environment as a system user and therefore is set to have a shell of
33 <command>/bin/false</command> and a home directory of <command>/dev/null.</command>
34 </para>
36 <para>
37 The creation of UNIX system accounts has traditionally been the sole right of
38 the system administrator, better known as the <constant>root</constant> account.
39 It is possible in the UNIX environment to create multiple users who have the
40 same UID. Any UNIX user who has a UID=0 is inherently the same as the
41 <constant>root</constant> account.
42 </para>
44 <para>
45 All versions of Samba call system interface scripts that permit CIFS function
46 calls that are used to manage users, groups, and machine accounts
47 in the UNIX environment. All versions of Samba up to and including version 3.0.10
48 required the use of a Windows administrator account that unambiguously maps to
49 the UNIX <constant>root</constant> account to permit the execution of these
50 interface scripts. The requirement to do this has understandably met with some
51 disdain and consternation among Samba administrators, particularly where it became
52 necessary to permit people who should not possess <constant>root</constant>-level
53 access to the UNIX host system.
54 </para>
56 <sect1>
57 <title>Rights Management Capabilities</title>
59 <para>
60 Samba 3.0.11 introduced support for the Windows privilege model.  This model
61 allows certain rights to be assigned to a user or group SID.  In order to enable
62 this feature, <smbconfoption name="enable privileges">yes</smbconfoption>
63 must be defined in the <smbconfsection name="global"/> section of the &smb.conf; file.
64 </para>
66 <para>
67 Currently, the rights supported in Samba-3 are listed in <link linkend="rp-privs"/>.
68 The remainder of this chapter explains how to manage and use these privileges on Samba servers.
69 </para>
71 <table id="rp-privs">
72         <title>Current Privilege Capabilities</title>
73         <tgroup cols="2">
74                 <colspec align="right"/>
75                 <colspec align="left"/>
76                 <thead>
77                         <row>
78                                 <entry align="left">Privilege</entry>
79                                 <entry align="left">Description</entry>
80                         </row>
81                 </thead>
82                 <tbody>
83                         <row>
84                                 <entry><para>SeMachineAccountPrivilege</para></entry>
85                                 <entry><para>Add machines to domain</para></entry>
86                         </row>
87                         <row>
88                                 <entry><para>SePrintOperatorPrivilege</para></entry>
89                                 <entry><para>Manage printers</para></entry>
90                         </row>
91                         <row>
92                                 <entry><para>SeAddUsersPrivilege</para></entry>
93                                 <entry><para>Add users and groups to the domain</para></entry>
94                         </row>
95                         <row>
96                                 <entry><para>SeRemoteShutdownPrivilege</para></entry>
97                                 <entry><para>Force shutdown from a remote system</para></entry>
98                         </row>
99                         <row>
100                                 <entry><para>SeDiskOperatorPrivilege</para></entry>
101                                 <entry><para>Manage disk share</para></entry>
102                         </row>
103                         <row>
104                                 <entry><para>SeBackupPrivilege</para></entry>
105                                 <entry><para>Back up files and directories</para></entry>
106                         </row>
107                         <row>
108                                 <entry><para>SeRestorePrivilege</para></entry>
109                                 <entry><para>Restore files and directories</para></entry>
110                         </row>
111                         <row>
112                                 <entry><para>SeTakeOwnershipPrivilege</para></entry>
113                                 <entry><para>Take ownership of files or other objects</para></entry>
114                         </row>
115                 </tbody>
116         </tgroup>
117 </table>
119 <sect2>
120 <title>Using the <quote>net rpc rights</quote> Utility</title>
122 <para>
123 There are two primary means of managing the rights assigned to users and groups
124 on a Samba server.  The <command>NT4 User Manager for Domains</command> may be
125 used from any Windows NT4, 2000, or XP Professional domain member client to
126 connect to a Samba domain controller and view/modify the rights assignments.
127 This application, however, appears to have bugs when run on a client running
128 Windows 2000 or later; therefore, Samba provides a command-line utility for
129 performing the necessary administrative actions.
130 </para>
132 <para>
133 The <command>net rpc rights</command> utility in Samba 3.0.11 has three new subcommands:
134 </para>
136 <variablelist>
137         <varlistentry><term>list [name|accounts]</term>
138                 <listitem><para>
139                 When called with no arguments, <command>net rpc list</command>
140                 simply lists the available rights on the server.  When passed
141                 a specific user or group name, the tool lists the privileges
142                 currently assigned to the specified account.  When invoked using
143                 the special string <constant>accounts</constant>,
144                 <command>net rpc rights list</command> returns a list of all
145                 privileged accounts on the server and the assigned rights.
146                 </para></listitem>
147         </varlistentry>
149         <varlistentry><term>grant &lt;user&gt; &lt;right [right ...]&gt;</term>
150                 <listitem><para>
151                 When called with no arguments, this function is used to assign
152                 a list of rights to a specified user or group.  For example,
153                 to grant the members of the Domain Admins group on a Samba domain controller,
154                 the capability to add client machines to the domain, one would run:
155 <screen>
156 &rootprompt; net -S server -U domadmin rpc rights grant \
157          'DOMAIN\Domain Admins' SeMachineAccountPrivilege
158 </screen>
159                 More than one privilege can be assigned by specifying a
160                 list of rights separated by spaces. The parameter 'Domain\Domain Admins'
161                 must be quoted with single ticks or using double-quotes to prevent
162                 the backslash and the space from being interpreted by the system shell.
163                 </para></listitem>
164         </varlistentry>
166         <varlistentry><term>revoke &lt;user&gt; &lt;right [right ...]&gt;</term>
167                 <listitem><para>
168                 This command is similar in format to <command>net rpc rights grant</command>.  Its
169                 effect is to remove an assigned right (or list of rights) from a user or group.
170                 </para></listitem>
171         </varlistentry>
173 </variablelist>
175 <note><para>
176 You must be connected as a member of the Domain Admins group to be able to
177 grant or revoke privileges assigned to an account.  This capability is
178 inherent to the Domain Admins group and is not configurable.
179 </para></note>
181 <para>
182 By default, no privileges are initially assigned to any
183 account because certain actions will
184 be performed as root once smbd determines that a user has
185 the necessary rights.  For example, when joining a client to
186 a Windows domain, the `add machine script' must be executed
187 with superuser rights in most cases.  For this reason, you
188 should be very careful about handing out privileges to
189 accounts.
190 </para>
192 <para>
193 Access as the root user (UID=0) bypasses all privilege checks.
194 </para>
196 </sect2>
198 <sect2>
199 <title>Description of Privileges</title>
201 <para>
202 The privileges that have been implemented in Samba-3.0.11 are shown below.
203 It is possible, and likely, that additional privileges may be implemented in
204 later releases of Samba. It is also likely that any privileges currently implemented
205 but not used may be removed from future releases, so it is important that
206 the successful as well as unsuccessful use of these facilities should be reported
207 on the Samba mailing lists.
208 </para>
210 <variablelist>
211         <varlistentry><term>SeAddUsersPrivilege</term>
212                 <listitem><para>
213                 This right determines whether or not smbd will allow the
214                 user to create new user or group accounts via such tools
215                 as <command>net rpc user add</command> or 
216                 <command>NT4 User Manager for Domains.</command>
217                 </para></listitem>
218         </varlistentry>
220         <varlistentry><term>SeDiskOperatorPrivilege</term>
221                 <listitem><para>
222                 Accounts that possess this right will be able to execute
223                 scripts defined by the <command>add/delete/change</command>
224                 share command in &smb.conf; file as root.  Such users will
225                 also be able to modify the ACL associated with file shares
226                 on the Samba server.
227                 </para></listitem>
228         </varlistentry>
230         <varlistentry><term>SeMachineAccountPrivilege</term>
231                 <listitem><para>
232                 Controls whether or not the user can join client
233                 machines to a Samba-controlled domain.
234                 </para></listitem>
235         </varlistentry>
237         <varlistentry><term>SePrintOperatorPrivilege</term>
238                 <listitem><para>
239                 This privilege operates identically to the
240                 <smbconfoption name="printer admin"/>
241                 option in the &smb.conf; file (see section 5 man page for &smb.conf;)
242                 except that it is a global right (not on a per-printer basis). 
243                 Eventually the smb.conf option will be deprecated and administrative
244                 rights to printers will be controlled exclusively by this right and
245                 the security descriptor associated with the printer object in the
246                 <filename>ntprinters.tdb</filename> file.
247                 </para></listitem>
248         </varlistentry>
250         <varlistentry><term>SeRemoteShutdownPrivilege</term>
251                 <listitem><para>
252                 Samba provides two hooks for shutting down or rebooting
253                 the server and for aborting a previously issued shutdown
254                 command.  Since this is an operation normally limited by
255                 the operating system to the root user, an account must possess this
256                 right to be able to execute either of these hooks.
257                 </para></listitem>
258         </varlistentry>
260 </variablelist>
262 </sect2>
264 <sect2>
265 <title>Privileges Suppored by Windows 2000 Domain Controllers</title>
267 <para>
268     For reference purposes, a Windows 2000 Domain Controller reports that it supports the following
269     privileges:
270 <screen>
271          SeCreateTokenPrivilege  Create a token object
272   SeAssignPrimaryTokenPrivilege  Replace a process level token
273           SeLockMemoryPrivilege  Lock pages in memory
274        SeIncreaseQuotaPrivilege  Increase quotas
275       SeMachineAccountPrivilege  Add workstations to domain
276                  SeTcbPrivilege  Act as part of the operating system
277             SeSecurityPrivilege  Manage auditing and security log
278        SeTakeOwnershipPrivilege  Take ownership of files or other objects
279           SeLoadDriverPrivilege  Load and unload device drivers
280        SeSystemProfilePrivilege  Profile system performance
281           SeSystemtimePrivilege  Change the system time
282 SeProfileSingleProcessPrivilege  Profile single process
283 SeIncreaseBasePriorityPrivilege  Increase scheduling priority
284       SeCreatePagefilePrivilege  Create a pagefile
285      SeCreatePermanentPrivilege  Create permanent shared objects
286               SeBackupPrivilege  Back up files and directories
287              SeRestorePrivilege  Restore files and directories
288             SeShutdownPrivilege  Shut down the system
289                SeDebugPrivilege  Debug programs
290                SeAuditPrivilege  Generate security audits
291    SeSystemEnvironmentPrivilege  Modify firmware environment values
292         SeChangeNotifyPrivilege  Bypass traverse checking
293       SeRemoteShutdownPrivilege  Force shutdown from a remote system
294               SeUndockPrivilege  Remove computer from docking station
295            SeSyncAgentPrivilege  Synchronize directory service data
296     SeEnableDelegationPrivilege  Enable computer and user accounts to
297                                  be trusted for delegation
298         SeManageVolumePrivilege  Perform volume maintenance tasks
299          SeImpersonatePrivilege  Impersonate a client after authentication
300         SeCreateGlobalPrivilege  Create global objects
301 </screen>
302     The Samba Team are implementing only those privileges that are logical and useful in the UNIX/Linux
303     envronment. Many of the Windows 200X/XP privileges have no direct equivalence in UNIX.
304     </para>
306 </sect2>
308 </sect1>
310 <sect1>
311 <title>The Administrator Domain SID</title>
313 <para>
314 Please note that every Windows NT4 and later server requires a domain Adminsitrator account. Samba version
315 commencing with 3.0.11 permit the Administrative duties to be performed via assigned rights and privileges
316 (see <link linkend="rights">User Rights and Privileges</link>).  An account in the server's passdb backend can
317 be set to the domain SID of the default administrator account.  To obtain the domain SID on a Samba domain
318 controller, run the following command:
319 <screen>
320 &rootprompt; net getlocalsid
321 SID for domain FOO is: S-1-5-21-4294955119-3368514841-2087710299
322 </screen>
323 You may assign the domain administrator RID to an account using the <command>pdbedit</command>
324 command as shown here:
325 <screen>
326 &rootprompt; pdbedit -U S-1-5-21-4294955119-3368514841-2087710299-500 -u root -r
327 </screen>
328 </para>
330 <note><para>
331 The RID 500 is the well known standard value of the default Administrator account. It is the RID
332 that confers the rights and privileges that the Administrator account has on a Windows machine
333 or domain. Under UNIX/Linux the equivalent is UID=0 (the root account).
334 </para></note>
336 <para>
337 Releases of Samba version 3.0.11 and later make it possible to operate without an Administrator account
338 providing equivalent rights and privileges have been established for a Windows user or a Windows
339 group account. 
340 </para>
342 </sect1>
344 <sect1>
345 <title>Common Errors</title>
347         <sect2>
348         <title>What Rights and Privileges Will Permit Windows Client Administration?</title>
350         <para>
351         When a Windows NT4 (or later) client joins a domain, the domain global <literal>Domain Admins</literal> group
352         is added to the membership of the local <literal>Administrators</literal> group on the client. Any user who is
353         a member of the domain global <literal>Domain Admins</literal> group will have administrative rights on the
354         Windows client.
355         </para>
357         <para>
358         This is often not the most desirable solution because it means that the user will have administrative
359         rights and privileges on domain servers also. The <literal>Power Users</literal> group on Windows client
360         workstations permits local administration of the workstation alone. Any domain global user or domain global
361         group can be added to the membership of the local workstation group <literal>Power Users</literal>.
362         </para>
364         <para>
365         See <link linkend="nestedgrpmgmgt">Nested Group Support</link> for an example of how to add domain users
366         and groups to a local group that is on a Windows workstation. The use of the <command>net</command>
367         command permits this to be done from the Samba server.
368         </para>
370         <para>
371         Another way this can be done is to log onto the Windows workstation as the user
372         <literal>Administrator</literal>, then open a <command>cmd</command> shell, then execute:
373 <screen>
374 c:\ net localgroup administrators /add <userinput>domain_name\entity</userinput>
375 </screen>
376         where <literal>entity</literal> is either a domain user or a domain group account name.
377         </para>
379         </sect2>
381 </sect1>
383 </chapter>