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