another merge from 2.2
[Samba/gbeck.git] / docs / docbook / projdoc / NT_Security.sgml
bloba6be4a0ffd598b9383d6fcb1ed9024bf2b113aa4
1 <chapter>
3 <chapterinfo>
4 <author>
5 <firstname>Jeremy</firstname><surname>Allison</surname>
6 <affiliation>
7 <orgname>Samba Team</orgname>
8 <address>
9 <email>samba@samba.org</email>
10 </address>
11 </affiliation>
12 </author>
15 <pubdate>12 Apr 1999</pubdate>
16 </chapterinfo>
19 <title>UNIX Permission Bits and WIndows NT Access Control Lists</title>
21 <sect1>
22 <title>Viewing and changing UNIX permissions using the NT
23 security dialogs</title>
26 <para>New in the Samba 2.0.4 release is the ability for Windows
27 NT clients to use their native security settings dialog box to
28 view and modify the underlying UNIX permissions.</para>
30 <para>Note that this ability is careful not to compromise
31 the security of the UNIX host Samba is running on, and
32 still obeys all the file permission rules that a Samba
33 administrator can set.</para>
35 <para>In Samba 2.0.4 and above the default value of the
36 parameter <ulink url="smb.conf.5.html#NTACLSUPPOR"><parameter>
37 nt acl support</parameter></ulink> has been changed from
38 <constant>false</constant> to <constant>true</constant>, so
39 manipulation of permissions is turned on by default.</para>
40 </sect1>
42 <sect1>
43 <title>How to view file security on a Samba share</title>
45 <para>From an NT 4.0 client, single-click with the right
46 mouse button on any file or directory in a Samba mounted
47 drive letter or UNC path. When the menu pops-up, click
48 on the <emphasis>Properties</emphasis> entry at the bottom of
49 the menu. This brings up the normal file properties dialog
50 box, but with Samba 2.0.4 this will have a new tab along the top
51 marked <emphasis>Security</emphasis>. Click on this tab and you
52 will see three buttons, <emphasis>Permissions</emphasis>,
53 <emphasis>Auditing</emphasis>, and <emphasis>Ownership</emphasis>.
54 The <emphasis>Auditing</emphasis> button will cause either
55 an error message <errorname>A requested privilege is not held
56 by the client</errorname> to appear if the user is not the
57 NT Administrator, or a dialog which is intended to allow an
58 Administrator to add auditing requirements to a file if the
59 user is logged on as the NT Administrator. This dialog is
60 non-functional with a Samba share at this time, as the only
61 useful button, the <command>Add</command> button will not currently
62 allow a list of users to be seen.</para>
64 </sect1>
66 <sect1>
67 <title>Viewing file ownership</title>
69 <para>Clicking on the <command>"Ownership"</command> button
70 brings up a dialog box telling you who owns the given file. The
71 owner name will be of the form :</para>
73 <para><command>"SERVER\user (Long name)"</command></para>
75 <para>Where <replaceable>SERVER</replaceable> is the NetBIOS name of
76 the Samba server, <replaceable>user</replaceable> is the user name of
77 the UNIX user who owns the file, and <replaceable>(Long name)</replaceable>
78 is the discriptive string identifying the user (normally found in the
79 GECOS field of the UNIX password database). Click on the <command>Close
80 </command> button to remove this dialog.</para>
82 <para>If the parameter <parameter>nt acl support</parameter>
83 is set to <constant>false</constant> then the file owner will
84 be shown as the NT user <command>"Everyone"</command>.</para>
86 <para>The <command>Take Ownership</command> button will not allow
87 you to change the ownership of this file to yourself (clicking on
88 it will display a dialog box complaining that the user you are
89 currently logged onto the NT client cannot be found). The reason
90 for this is that changing the ownership of a file is a privilaged
91 operation in UNIX, available only to the <emphasis>root</emphasis>
92 user. As clicking on this button causes NT to attempt to change
93 the ownership of a file to the current user logged into the NT
94 client this will not work with Samba at this time.</para>
96 <para>There is an NT chown command that will work with Samba
97 and allow a user with Administrator privillage connected
98 to a Samba 2.0.4 server as root to change the ownership of
99 files on both a local NTFS filesystem or remote mounted NTFS
100 or Samba drive. This is available as part of the <emphasis>Seclib
101 </emphasis> NT security library written by Jeremy Allison of
102 the Samba Team, available from the main Samba ftp site.</para>
104 </sect1>
106 <sect1>
107 <title>Viewing file or directory permissions</title>
109 <para>The third button is the <command>"Permissions"</command>
110 button. Clicking on this brings up a dialog box that shows both
111 the permissions and the UNIX owner of the file or directory.
112 The owner is displayed in the form :</para>
114 <para><command>"SERVER\user (Long name)"</command></para>
116 <para>Where <replaceable>SERVER</replaceable> is the NetBIOS name of
117 the Samba server, <replaceable>user</replaceable> is the user name of
118 the UNIX user who owns the file, and <replaceable>(Long name)</replaceable>
119 is the discriptive string identifying the user (normally found in the
120 GECOS field of the UNIX password database).</para>
122 <para>If the parameter <parameter>nt acl support</parameter>
123 is set to <constant>false</constant> then the file owner will
124 be shown as the NT user <command>"Everyone"</command> and the
125 permissions will be shown as NT "Full Control".</para>
128 <para>The permissions field is displayed differently for files
129 and directories, so I'll describe the way file permissions
130 are displayed first.</para>
132 <sect2>
133 <title>File Permissions</title>
135 <para>The standard UNIX user/group/world triple and
136 the correspinding "read", "write", "execute" permissions
137 triples are mapped by Samba into a three element NT ACL
138 with the 'r', 'w', and 'x' bits mapped into the corresponding
139 NT permissions. The UNIX world permissions are mapped into
140 the global NT group <command>Everyone</command>, followed
141 by the list of permissions allowed for UNIX world. The UNIX
142 owner and group permissions are displayed as an NT
143 <command>user</command> icon and an NT <command>local
144 group</command> icon respectively followed by the list
145 of permissions allowed for the UNIX user and group.</para>
147 <para>As many UNIX permission sets don't map into common
148 NT names such as <command>"read"</command>, <command>
149 "change"</command> or <command>"full control"</command> then
150 usually the permissions will be prefixed by the words <command>
151 "Special Access"</command> in the NT display list.</para>
153 <para>But what happens if the file has no permissions allowed
154 for a particular UNIX user group or world component ? In order
155 to allow "no permissions" to be seen and modified then Samba
156 overloads the NT <command>"Take Ownership"</command> ACL attribute
157 (which has no meaning in UNIX) and reports a component with
158 no permissions as having the NT <command>"O"</command> bit set.
159 This was chosen of course to make it look like a zero, meaning
160 zero permissions. More details on the decision behind this will
161 be given below.</para>
162 </sect2>
164 <sect2>
165 <title>Directory Permissions</title>
167 <para>Directories on an NT NTFS file system have two
168 different sets of permissions. The first set of permissions
169 is the ACL set on the directory itself, this is usually displayed
170 in the first set of parentheses in the normal <command>"RW"</command>
171 NT style. This first set of permissions is created by Samba in
172 exactly the same way as normal file permissions are, described
173 above, and is displayed in the same way.</para>
175 <para>The second set of directory permissions has no real meaning
176 in the UNIX permissions world and represents the <command>
177 "inherited"</command> permissions that any file created within
178 this directory would inherit.</para>
180 <para>Samba synthesises these inherited permissions for NT by
181 returning as an NT ACL the UNIX permission mode that a new file
182 created by Samba on this share would receive.</para>
183 </sect2>
184 </sect1>
186 <sect1>
187 <title>Modifying file or directory permissions</title>
189 <para>Modifying file and directory permissions is as simple
190 as changing the displayed permissions in the dialog box, and
191 clicking the <command>OK</command> button. However, there are
192 limitations that a user needs to be aware of, and also interactions
193 with the standard Samba permission masks and mapping of DOS
194 attributes that need to also be taken into account.</para>
196 <para>If the parameter <parameter>nt acl support</parameter>
197 is set to <constant>false</constant> then any attempt to set
198 security permissions will fail with an <command>"Access Denied"
199 </command> message.</para>
201 <para>The first thing to note is that the <command>"Add"</command>
202 button will not return a list of users in Samba 2.0.4 (it will give
203 an error message of <command>"The remote proceedure call failed
204 and did not execute"</command>). This means that you can only
205 manipulate the current user/group/world permissions listed in
206 the dialog box. This actually works quite well as these are the
207 only permissions that UNIX actually has.</para>
209 <para>If a permission triple (either user, group, or world)
210 is removed from the list of permissions in the NT dialog box,
211 then when the <command>"OK"</command> button is pressed it will
212 be applied as "no permissions" on the UNIX side. If you then
213 view the permissions again the "no permissions" entry will appear
214 as the NT <command>"O"</command> flag, as described above. This
215 allows you to add permissions back to a file or directory once
216 you have removed them from a triple component.</para>
218 <para>As UNIX supports only the "r", "w" and "x" bits of
219 an NT ACL then if other NT security attributes such as "Delete
220 access" are selected then they will be ignored when applied on
221 the Samba server.</para>
223 <para>When setting permissions on a directory the second
224 set of permissions (in the second set of parentheses) is
225 by default applied to all files within that directory. If this
226 is not what you want you must uncheck the <command>"Replace
227 permissions on existing files"</command> checkbox in the NT
228 dialog before clicking <command>"OK"</command>.</para>
230 <para>If you wish to remove all permissions from a
231 user/group/world component then you may either highlight the
232 component and click the <command>"Remove"</command> button,
233 or set the component to only have the special <command>"Take
234 Ownership"</command> permission (dsplayed as <command>"O"
235 </command>) highlighted.</para>
236 </sect1>
238 <sect1>
239 <title>Interaction with the standard Samba create mask
240 parameters</title>
242 <para>Note that with Samba 2.0.5 there are four new parameters
243 to control this interaction. These are :</para>
245 <para><parameter>security mask</parameter></para>
246 <para><parameter>force security mode</parameter></para>
247 <para><parameter>directory security mask</parameter></para>
248 <para><parameter>force directory security mode</parameter></para>
250 <para>Once a user clicks <command>"OK"</command> to apply the
251 permissions Samba maps the given permissions into a user/group/world
252 r/w/x triple set, and then will check the changed permissions for a
253 file against the bits set in the <ulink url="smb.conf.5.html#SECURITYMASK">
254 <parameter>security mask</parameter></ulink> parameter. Any bits that
255 were changed that are not set to '1' in this parameter are left alone
256 in the file permissions.</para>
258 <para>Essentially, zero bits in the <parameter>security mask</parameter>
259 mask may be treated as a set of bits the user is <emphasis>not</emphasis>
260 allowed to change, and one bits are those the user is allowed to change.
261 </para>
263 <para>If not set explicitly this parameter is set to the same value as
264 the <ulink url="smb.conf.5.html#CREATEMASK"><parameter>create mask
265 </parameter></ulink> parameter to provide compatibility with Samba 2.0.4
266 where this permission change facility was introduced. To allow a user to
267 modify all the user/group/world permissions on a file, set this parameter
268 to 0777.</para>
270 <para>Next Samba checks the changed permissions for a file against
271 the bits set in the <ulink url="smb.conf.5.html#FORCESECURITYMODE">
272 <parameter>force security mode</parameter></ulink> parameter. Any bits
273 that were changed that correspond to bits set to '1' in this parameter
274 are forced to be set.</para>
276 <para>Essentially, bits set in the <parameter>force security mode
277 </parameter> parameter may be treated as a set of bits that, when
278 modifying security on a file, the user has always set to be 'on'.</para>
280 <para>If not set explicitly this parameter is set to the same value
281 as the <ulink url="smb.conf.5.html#FORCECREATEMODE"><parameter>force
282 create mode</parameter></ulink> parameter to provide compatibility
283 with Samba 2.0.4 where the permission change facility was introduced.
284 To allow a user to modify all the user/group/world permissions on a file,
285 with no restrictions set this parameter to 000.</para>
287 <para>The <parameter>security mask</parameter> and <parameter>force
288 security mode</parameter> parameters are applied to the change
289 request in that order.</para>
291 <para>For a directory Samba will perform the same operations as
292 described above for a file except using the parameter <parameter>
293 directory security mask</parameter> instead of <parameter>security
294 mask</parameter>, and <parameter>force directory security mode
295 </parameter> parameter instead of <parameter>force security mode
296 </parameter>.</para>
298 <para>The <parameter>directory security mask</parameter> parameter
299 by default is set to the same value as the <parameter>directory mask
300 </parameter> parameter and the <parameter>force directory security
301 mode</parameter> parameter by default is set to the same value as
302 the <parameter>force directory mode</parameter> parameter to provide
303 compatibility with Samba 2.0.4 where the permission change facility
304 was introduced.</para>
306 <para>In this way Samba enforces the permission restrictions that
307 an administrator can set on a Samba share, whilst still allowing users
308 to modify the permission bits within that restriction.</para>
310 <para>If you want to set up a share that allows users full control
311 in modifying the permission bits on their files and directories and
312 doesn't force any particular bits to be set 'on', then set the following
313 parameters in the <ulink url="smb.conf.5.html"><filename>smb.conf(5)
314 </filename></ulink> file in that share specific section :</para>
316 <para><parameter>security mask = 0777</parameter></para>
317 <para><parameter>force security mode = 0</parameter></para>
318 <para><parameter>directory security mask = 0777</parameter></para>
319 <para><parameter>force directory security mode = 0</parameter></para>
321 <para>As described, in Samba 2.0.4 the parameters :</para>
323 <para><parameter>create mask</parameter></para>
324 <para><parameter>force create mode</parameter></para>
325 <para><parameter>directory mask</parameter></para>
326 <para><parameter>force directory mode</parameter></para>
328 <para>were used instead of the parameters discussed here.</para>
329 </sect1>
331 <sect1>
332 <title>Interaction with the standard Samba file attribute
333 mapping</title>
335 <para>Samba maps some of the DOS attribute bits (such as "read
336 only") into the UNIX permissions of a file. This means there can
337 be a conflict between the permission bits set via the security
338 dialog and the permission bits set by the file attribute mapping.
339 </para>
341 <para>One way this can show up is if a file has no UNIX read access
342 for the owner it will show up as "read only" in the standard
343 file attributes tabbed dialog. Unfortunately this dialog is
344 the same one that contains the security info in another tab.</para>
346 <para>What this can mean is that if the owner changes the permissions
347 to allow themselves read access using the security dialog, clicks
348 <command>"OK"</command> to get back to the standard attributes tab
349 dialog, and then clicks <command>"OK"</command> on that dialog, then
350 NT will set the file permissions back to read-only (as that is what
351 the attributes still say in the dialog). This means that after setting
352 permissions and clicking <command>"OK"</command> to get back to the
353 attributes dialog you should always hit <command>"Cancel"</command>
354 rather than <command>"OK"</command> to ensure that your changes
355 are not overridden.</para>
356 </sect1>
358 </chapter>