fixing typos spotted by eagle-eye-vance
[samba.git] / docs / htmldocs / NT_Security.html
1 <HTML
2 ><HEAD
3 ><TITLE
4 >UNIX Permission Bits and Windows NT Access Control Lists</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.57"></HEAD
8 ><BODY
9 CLASS="ARTICLE"
10 BGCOLOR="#FFFFFF"
11 TEXT="#000000"
12 LINK="#0000FF"
13 VLINK="#840084"
14 ALINK="#0000FF"
15 ><DIV
16 CLASS="ARTICLE"
17 ><DIV
18 CLASS="TITLEPAGE"
19 ><H1
20 CLASS="TITLE"
21 ><A
22 NAME="UNIX-PERMISSIONS"
23 >UNIX Permission Bits and Windows NT Access Control Lists</A
24 ></H1
25 ><HR></DIV
26 ><DIV
27 CLASS="SECT1"
28 ><H1
29 CLASS="SECT1"
30 ><A
31 NAME="AEN3"
32 >Viewing and changing UNIX permissions using the NT 
33         security dialogs</A
34 ></H1
35 ><P
36 >New in the Samba 2.0.4 release is the ability for Windows 
37         NT clients to use their native security settings dialog box to 
38         view and modify the underlying UNIX permissions.</P
39 ><P
40 >Note that this ability is careful not to compromise 
41         the security of the UNIX host Samba is running on, and 
42         still obeys all the file permission rules that a Samba 
43         administrator can set.</P
44 ><P
45 >In Samba 2.0.4 and above the default value of the 
46         parameter <A
47 HREF="smb.conf.5.html#NTACLSUPPORT"
48 TARGET="_top"
49 ><TT
50 CLASS="PARAMETER"
51 ><I
52 >       nt acl support</I
53 ></TT
54 ></A
55 > has been changed from 
56         <TT
57 CLASS="CONSTANT"
58 >false</TT
59 > to <TT
60 CLASS="CONSTANT"
61 >true</TT
62 >, so 
63         manipulation of permissions is turned on by default.</P
64 ></DIV
65 ><DIV
66 CLASS="SECT1"
67 ><HR><H1
68 CLASS="SECT1"
69 ><A
70 NAME="AEN12"
71 >How to view file security on a Samba share</A
72 ></H1
73 ><P
74 >From an NT 4.0 client, single-click with the right 
75         mouse button on any file or directory in a Samba mounted 
76         drive letter or UNC path. When the menu pops-up, click 
77         on the <I
78 CLASS="EMPHASIS"
79 >Properties</I
80 > entry at the bottom of 
81         the menu. This brings up the normal file properties dialog
82         box, but with Samba 2.0.4 this will have a new tab along the top
83         marked <I
84 CLASS="EMPHASIS"
85 >Security</I
86 >. Click on this tab and you 
87         will see three buttons, <I
88 CLASS="EMPHASIS"
89 >Permissions</I
90 >,      
91         <I
92 CLASS="EMPHASIS"
93 >Auditing</I
94 >, and <I
95 CLASS="EMPHASIS"
96 >Ownership</I
97 >. 
98         The <I
99 CLASS="EMPHASIS"
100 >Auditing</I
101 > button will cause either 
102         an error message <SPAN
103 CLASS="ERRORNAME"
104 >A requested privilege is not held 
105         by the client</SPAN
106 > to appear if the user is not the 
107         NT Administrator, or a dialog which is intended to allow an 
108         Administrator to add auditing requirements to a file if the 
109         user is logged on as the NT Administrator. This dialog is 
110         non-functional with a Samba share at this time, as the only 
111         useful button, the <B
112 CLASS="COMMAND"
113 >Add</B
114 > button will not currently 
115         allow a list of users to be seen.</P
116 ></DIV
117 ><DIV
118 CLASS="SECT1"
119 ><HR><H1
120 CLASS="SECT1"
121 ><A
122 NAME="AEN23"
123 >Viewing file ownership</A
124 ></H1
125 ><P
126 >Clicking on the <B
127 CLASS="COMMAND"
128 >"Ownership"</B
129 > button 
130         brings up a dialog box telling you who owns the given file. The 
131         owner name will be of the form :</P
132 ><P
133 ><B
134 CLASS="COMMAND"
135 >"SERVER\user (Long name)"</B
136 ></P
137 ><P
138 >Where <TT
139 CLASS="REPLACEABLE"
140 ><I
141 >SERVER</I
142 ></TT
143 > is the NetBIOS name of 
144         the Samba server, <TT
145 CLASS="REPLACEABLE"
146 ><I
147 >user</I
148 ></TT
149 > is the user name of 
150         the UNIX user who owns the file, and <TT
151 CLASS="REPLACEABLE"
152 ><I
153 >(Long name)</I
154 ></TT
155 >
156         is the descriptive string identifying the user (normally found in the
157         GECOS field of the UNIX password database). Click on the <B
158 CLASS="COMMAND"
159 >Close
160         </B
161 > button to remove this dialog.</P
162 ><P
163 >If the parameter <TT
164 CLASS="PARAMETER"
165 ><I
166 >nt acl support</I
167 ></TT
168 >
169         is set to <TT
170 CLASS="CONSTANT"
171 >false</TT
172 > then the file owner will 
173         be shown as the NT user <B
174 CLASS="COMMAND"
175 >"Everyone"</B
176 >.</P
177 ><P
178 >The <B
179 CLASS="COMMAND"
180 >Take Ownership</B
181 > button will not allow 
182         you to change the ownership of this file to yourself (clicking on 
183         it will display a dialog box complaining that the user you are 
184         currently logged onto the NT client cannot be found). The reason 
185         for this is that changing the ownership of a file is a privileged 
186         operation in UNIX, available only to the <I
187 CLASS="EMPHASIS"
188 >root</I
189
190         user. As clicking on this button causes NT to attempt to change 
191         the ownership of a file to the current user logged into the NT 
192         client this will not work with Samba at this time.</P
193 ><P
194 >There is an NT chown command that will work with Samba 
195         and allow a user with Administrator privilege connected 
196         to a Samba 2.0.4 server as root to change the ownership of 
197         files on both a local NTFS filesystem or remote mounted NTFS 
198         or Samba drive. This is available as part of the <I
199 CLASS="EMPHASIS"
200 >Seclib
201         </I
202 > NT security library written by Jeremy Allison of 
203         the Samba Team, available from the main Samba ftp site.</P
204 ></DIV
205 ><DIV
206 CLASS="SECT1"
207 ><HR><H1
208 CLASS="SECT1"
209 ><A
210 NAME="AEN43"
211 >Viewing file or directory permissions</A
212 ></H1
213 ><P
214 >The third button is the <B
215 CLASS="COMMAND"
216 >"Permissions"</B
217
218         button. Clicking on this brings up a dialog box that shows both 
219         the permissions and the UNIX owner of the file or directory. 
220         The owner is displayed in the form :</P
221 ><P
222 ><B
223 CLASS="COMMAND"
224 >"SERVER\user (Long name)"</B
225 ></P
226 ><P
227 >Where <TT
228 CLASS="REPLACEABLE"
229 ><I
230 >SERVER</I
231 ></TT
232 > is the NetBIOS name of 
233         the Samba server, <TT
234 CLASS="REPLACEABLE"
235 ><I
236 >user</I
237 ></TT
238 > is the user name of 
239         the UNIX user who owns the file, and <TT
240 CLASS="REPLACEABLE"
241 ><I
242 >(Long name)</I
243 ></TT
244 >
245         is the descriptive string identifying the user (normally found in the
246         GECOS field of the UNIX password database).</P
247 ><P
248 >If the parameter <TT
249 CLASS="PARAMETER"
250 ><I
251 >nt acl support</I
252 ></TT
253 >
254         is set to <TT
255 CLASS="CONSTANT"
256 >false</TT
257 > then the file owner will 
258         be shown as the NT user <B
259 CLASS="COMMAND"
260 >"Everyone"</B
261 > and the 
262         permissions will be shown as NT "Full Control".</P
263 ><P
264 >The permissions field is displayed differently for files 
265         and directories, so I'll describe the way file permissions 
266         are displayed first.</P
267 ><DIV
268 CLASS="SECT2"
269 ><HR><H2
270 CLASS="SECT2"
271 ><A
272 NAME="AEN58"
273 >File Permissions</A
274 ></H2
275 ><P
276 >The standard UNIX user/group/world triple and 
277                 the corresponding "read", "write", "execute" permissions 
278                 triples are mapped by Samba into a three element NT ACL 
279                 with the 'r', 'w', and 'x' bits mapped into the corresponding 
280                 NT permissions. The UNIX world permissions are mapped into 
281                 the global NT group <B
282 CLASS="COMMAND"
283 >Everyone</B
284 >, followed 
285                 by the list of permissions allowed for UNIX world. The UNIX 
286                 owner and group permissions are displayed as an NT 
287                 <B
288 CLASS="COMMAND"
289 >user</B
290 > icon and an NT <B
291 CLASS="COMMAND"
292 >local 
293                 group</B
294 > icon respectively followed by the list 
295                 of permissions allowed for the UNIX user and group.</P
296 ><P
297 >As many UNIX permission sets don't map into common 
298                 NT names such as <B
299 CLASS="COMMAND"
300 >"read"</B
301 >, <B
302 CLASS="COMMAND"
303 >               "change"</B
304 > or <B
305 CLASS="COMMAND"
306 >"full control"</B
307 > then 
308                 usually the permissions will be prefixed by the words <B
309 CLASS="COMMAND"
310 >               "Special Access"</B
311 > in the NT display list.</P
312 ><P
313 >But what happens if the file has no permissions allowed 
314                 for a particular UNIX user group or world component ? In order 
315                 to  allow "no permissions" to be seen and modified then Samba 
316                 overloads the NT <B
317 CLASS="COMMAND"
318 >"Take Ownership"</B
319 > ACL attribute 
320                 (which has no meaning in UNIX) and reports a component with 
321                 no permissions as having the NT <B
322 CLASS="COMMAND"
323 >"O"</B
324 > bit set. 
325                 This was chosen of course to make it look like a zero, meaning 
326                 zero permissions. More details on the decision behind this will 
327                 be given below.</P
328 ></DIV
329 ><DIV
330 CLASS="SECT2"
331 ><HR><H2
332 CLASS="SECT2"
333 ><A
334 NAME="AEN72"
335 >Directory Permissions</A
336 ></H2
337 ><P
338 >Directories on an NT NTFS file system have two 
339                 different sets of permissions. The first set of permissions 
340                 is the ACL set on the directory itself, this is usually displayed 
341                 in the first set of parentheses in the normal <B
342 CLASS="COMMAND"
343 >"RW"</B
344
345                 NT style. This first set of permissions is created by Samba in 
346                 exactly the same way as normal file permissions are, described 
347                 above, and is displayed in the same way.</P
348 ><P
349 >The second set of directory permissions has no real meaning 
350                 in the UNIX permissions world and represents the <B
351 CLASS="COMMAND"
352 >               "inherited"</B
353 > permissions that any file created within 
354                 this directory would inherit.</P
355 ><P
356 >Samba synthesises these inherited permissions for NT by 
357                 returning as an NT ACL the UNIX permission mode that a new file 
358                 created by Samba on this share would receive.</P
359 ></DIV
360 ></DIV
361 ><DIV
362 CLASS="SECT1"
363 ><HR><H1
364 CLASS="SECT1"
365 ><A
366 NAME="AEN79"
367 >Modifying file or directory permissions</A
368 ></H1
369 ><P
370 >Modifying file and directory permissions is as simple 
371         as changing the displayed permissions in the dialog box, and 
372         clicking the <B
373 CLASS="COMMAND"
374 >OK</B
375 > button. However, there are 
376         limitations that a user needs to be aware of, and also interactions 
377         with the standard Samba permission masks and mapping of DOS 
378         attributes that need to also be taken into account.</P
379 ><P
380 >If the parameter <TT
381 CLASS="PARAMETER"
382 ><I
383 >nt acl support</I
384 ></TT
385 >
386         is set to <TT
387 CLASS="CONSTANT"
388 >false</TT
389 > then any attempt to set 
390         security permissions will fail with an <B
391 CLASS="COMMAND"
392 >"Access Denied"
393         </B
394 > message.</P
395 ><P
396 >The first thing to note is that the <B
397 CLASS="COMMAND"
398 >"Add"</B
399
400         button will not return a list of users in Samba 2.0.4 (it will give 
401         an error message of <B
402 CLASS="COMMAND"
403 >"The remote procedure call failed 
404         and did not execute"</B
405 >). This means that you can only 
406         manipulate the current user/group/world permissions listed in 
407         the dialog box. This actually works quite well as these are the 
408         only permissions that UNIX actually has.</P
409 ><P
410 >If a permission triple (either user, group, or world) 
411         is removed from the list of permissions in the NT dialog box, 
412         then when the <B
413 CLASS="COMMAND"
414 >"OK"</B
415 > button is pressed it will 
416         be applied as "no permissions" on the UNIX side. If you then 
417         view the permissions again the "no permissions" entry will appear 
418         as the NT <B
419 CLASS="COMMAND"
420 >"O"</B
421 > flag, as described above. This 
422         allows you to add permissions back to a file or directory once 
423         you have removed them from a triple component.</P
424 ><P
425 >As UNIX supports only the "r", "w" and "x" bits of 
426         an NT ACL then if other NT security attributes such as "Delete 
427         access" are selected then they will be ignored when applied on 
428         the Samba server.</P
429 ><P
430 >When setting permissions on a directory the second 
431         set of permissions (in the second set of parentheses) is 
432         by default applied to all files within that directory. If this 
433         is not what you want you must uncheck the <B
434 CLASS="COMMAND"
435 >"Replace 
436         permissions on existing files"</B
437 > checkbox in the NT 
438         dialog before clicking <B
439 CLASS="COMMAND"
440 >"OK"</B
441 >.</P
442 ><P
443 >If you wish to remove all permissions from a 
444         user/group/world  component then you may either highlight the 
445         component and click the <B
446 CLASS="COMMAND"
447 >"Remove"</B
448 > button, 
449         or set the component to only have the special <B
450 CLASS="COMMAND"
451 >"Take
452         Ownership"</B
453 > permission (displayed as <B
454 CLASS="COMMAND"
455 >"O"
456         </B
457 >) highlighted.</P
458 ></DIV
459 ><DIV
460 CLASS="SECT1"
461 ><HR><H1
462 CLASS="SECT1"
463 ><A
464 NAME="AEN101"
465 >Interaction with the standard Samba create mask 
466         parameters</A
467 ></H1
468 ><P
469 >Note that with Samba 2.0.5 there are four new parameters 
470         to control this interaction.  These are :</P
471 ><P
472 ><TT
473 CLASS="PARAMETER"
474 ><I
475 >security mask</I
476 ></TT
477 ></P
478 ><P
479 ><TT
480 CLASS="PARAMETER"
481 ><I
482 >force security mode</I
483 ></TT
484 ></P
485 ><P
486 ><TT
487 CLASS="PARAMETER"
488 ><I
489 >directory security mask</I
490 ></TT
491 ></P
492 ><P
493 ><TT
494 CLASS="PARAMETER"
495 ><I
496 >force directory security mode</I
497 ></TT
498 ></P
499 ><P
500 >Once a user clicks <B
501 CLASS="COMMAND"
502 >"OK"</B
503 > to apply the 
504         permissions Samba maps the given permissions into a user/group/world 
505         r/w/x triple set, and then will check the changed permissions for a 
506         file against the bits set in the <A
507 HREF="smb.conf.5.html#SECURITYMASK"
508 TARGET="_top"
509
510         <TT
511 CLASS="PARAMETER"
512 ><I
513 >security mask</I
514 ></TT
515 ></A
516 > parameter. Any bits that 
517         were changed that are not set to '1' in this parameter are left alone 
518         in the file permissions.</P
519 ><P
520 >Essentially, zero bits in the <TT
521 CLASS="PARAMETER"
522 ><I
523 >security mask</I
524 ></TT
525 >
526         mask may be treated as a set of bits the user is <I
527 CLASS="EMPHASIS"
528 >not</I
529
530         allowed to change, and one bits are those the user is allowed to change.
531         </P
532 ><P
533 >If not set explicitly this parameter is set to the same value as 
534         the <A
535 HREF="smb.conf.5.html#CREATEMASK"
536 TARGET="_top"
537 ><TT
538 CLASS="PARAMETER"
539 ><I
540 >create mask
541         </I
542 ></TT
543 ></A
544 > parameter to provide compatibility with Samba 2.0.4 
545         where this permission change facility was introduced. To allow a user to 
546         modify all the user/group/world permissions on a file, set this parameter 
547         to 0777.</P
548 ><P
549 >Next Samba checks the changed permissions for a file against 
550         the bits set in the <A
551 HREF="smb.conf.5.html#FORCESECURITYMODE"
552 TARGET="_top"
553 >       <TT
554 CLASS="PARAMETER"
555 ><I
556 >force security mode</I
557 ></TT
558 ></A
559 > parameter. Any bits 
560         that were changed that correspond to bits set to '1' in this parameter 
561         are forced to be set.</P
562 ><P
563 >Essentially, bits set in the <TT
564 CLASS="PARAMETER"
565 ><I
566 >force security mode
567         </I
568 ></TT
569 > parameter may be treated as a set of bits that, when 
570         modifying security on a file, the user has always set to be 'on'.</P
571 ><P
572 >If not set explicitly this parameter is set to the same value 
573         as the <A
574 HREF="smb.conf.5.html#FORCECREATEMODE"
575 TARGET="_top"
576 ><TT
577 CLASS="PARAMETER"
578 ><I
579 >force 
580         create mode</I
581 ></TT
582 ></A
583 > parameter to provide compatibility
584         with Samba 2.0.4 where the permission change facility was introduced.
585         To allow a user to modify all the user/group/world permissions on a file
586         with no restrictions set this parameter to 000.</P
587 ><P
588 >The <TT
589 CLASS="PARAMETER"
590 ><I
591 >security mask</I
592 ></TT
593 > and <TT
594 CLASS="PARAMETER"
595 ><I
596 >force 
597         security mode</I
598 ></TT
599 > parameters are applied to the change 
600         request in that order.</P
601 ><P
602 >For a directory Samba will perform the same operations as 
603         described above for a file except using the parameter <TT
604 CLASS="PARAMETER"
605 ><I
606 >       directory security mask</I
607 ></TT
608 > instead of <TT
609 CLASS="PARAMETER"
610 ><I
611 >security 
612         mask</I
613 ></TT
614 >, and <TT
615 CLASS="PARAMETER"
616 ><I
617 >force directory security mode
618         </I
619 ></TT
620 > parameter instead of <TT
621 CLASS="PARAMETER"
622 ><I
623 >force security mode
624         </I
625 ></TT
626 >.</P
627 ><P
628 >The <TT
629 CLASS="PARAMETER"
630 ><I
631 >directory security mask</I
632 ></TT
633 > parameter 
634         by default is set to the same value as the <TT
635 CLASS="PARAMETER"
636 ><I
637 >directory mask
638         </I
639 ></TT
640 > parameter and the <TT
641 CLASS="PARAMETER"
642 ><I
643 >force directory security 
644         mode</I
645 ></TT
646 > parameter by default is set to the same value as 
647         the <TT
648 CLASS="PARAMETER"
649 ><I
650 >force directory mode</I
651 ></TT
652 > parameter to provide 
653         compatibility with Samba 2.0.4 where the permission change facility 
654         was introduced.</P
655 ><P
656 >In this way Samba enforces the permission restrictions that 
657         an administrator can set on a Samba share, whilst still allowing users 
658         to modify the permission bits within that restriction.</P
659 ><P
660 >If you want to set up a share that allows users full control
661         in modifying the permission bits on their files and directories and
662         doesn't force any particular bits to be set 'on', then set the following
663         parameters in the <A
664 HREF="smb.conf.5.html"
665 TARGET="_top"
666 ><TT
667 CLASS="FILENAME"
668 >smb.conf(5)
669         </TT
670 ></A
671 > file in that share specific section :</P
672 ><P
673 ><TT
674 CLASS="PARAMETER"
675 ><I
676 >security mask = 0777</I
677 ></TT
678 ></P
679 ><P
680 ><TT
681 CLASS="PARAMETER"
682 ><I
683 >force security mode = 0</I
684 ></TT
685 ></P
686 ><P
687 ><TT
688 CLASS="PARAMETER"
689 ><I
690 >directory security mask = 0777</I
691 ></TT
692 ></P
693 ><P
694 ><TT
695 CLASS="PARAMETER"
696 ><I
697 >force directory security mode = 0</I
698 ></TT
699 ></P
700 ><P
701 >As described, in Samba 2.0.4 the parameters :</P
702 ><P
703 ><TT
704 CLASS="PARAMETER"
705 ><I
706 >create mask</I
707 ></TT
708 ></P
709 ><P
710 ><TT
711 CLASS="PARAMETER"
712 ><I
713 >force create mode</I
714 ></TT
715 ></P
716 ><P
717 ><TT
718 CLASS="PARAMETER"
719 ><I
720 >directory mask</I
721 ></TT
722 ></P
723 ><P
724 ><TT
725 CLASS="PARAMETER"
726 ><I
727 >force directory mode</I
728 ></TT
729 ></P
730 ><P
731 >were used instead of the parameters discussed here.</P
732 ></DIV
733 ><DIV
734 CLASS="SECT1"
735 ><HR><H1
736 CLASS="SECT1"
737 ><A
738 NAME="AEN165"
739 >Interaction with the standard Samba file attribute 
740         mapping</A
741 ></H1
742 ><P
743 >Samba maps some of the DOS attribute bits (such as "read 
744         only") into the UNIX permissions of a file. This means there can 
745         be a conflict between the permission bits set via the security 
746         dialog and the permission bits set by the file attribute mapping.
747         </P
748 ><P
749 >One way this can show up is if a file has no UNIX read access
750         for the owner it will show up as "read only" in the standard 
751         file attributes tabbed dialog. Unfortunately this dialog is
752         the same one that contains the security info in another tab.</P
753 ><P
754 >What this can mean is that if the owner changes the permissions
755         to allow themselves read access using the security dialog, clicks
756         <B
757 CLASS="COMMAND"
758 >"OK"</B
759 > to get back to the standard attributes tab 
760         dialog, and then clicks <B
761 CLASS="COMMAND"
762 >"OK"</B
763 > on that dialog, then 
764         NT will set the file permissions back to read-only (as that is what 
765         the attributes still say in the dialog). This means that after setting 
766         permissions and clicking <B
767 CLASS="COMMAND"
768 >"OK"</B
769 > to get back to the 
770         attributes dialog you should always hit <B
771 CLASS="COMMAND"
772 >"Cancel"</B
773
774         rather than <B
775 CLASS="COMMAND"
776 >"OK"</B
777 > to ensure that your changes 
778         are not overridden.</P
779 ></DIV
780 ></DIV
781 ></BODY
782 ></HTML
783 >