1 <chapter id="AccessControls">
5 <pubdate>May 10, 2003</pubdate>
7 <title>File, Directory and Share Access Controls</title>
10 Advanced MS Windows users are frequently perplexed when file, directory and share manipulation of
11 resources shared via Samba do not behave in the manner they might expect. MS Windows network
12 adminstrators are often confused regarding network access controls and what is the best way to
13 provide users with the type of access they need while protecting resources from the consequences
14 of untoward access capabilities.
18 Unix administrators frequently are not familiar with the MS Windows environment and in particular
19 have difficulty in visualizing what the MS Windows user wishes to achieve in attempts to set file
20 and directory access permissions.
24 The problem lies in the differences in how file and directory permissions and controls work
25 between the two environments. This difference is one that Samba can not completely hide, even
26 though it does try to make the chasm transparent.
30 POSIX Access Control List technology has been available (along with Extended Attributes)
31 for Unix for many years, yet there is little evidence today of any significant use. This
32 explains to some extent the slow adoption of ACLs into commercial Linux products. MS Windows
33 administrators are astounded at this given that ACLs were a foundational capability of the now
34 decade old MS Windows NT operating system.
38 The purpose of this chapter is to present each of the points of control that are possible with
39 Samba-3 in the hope that this will help the network administrator to find the optimum method
40 for delivering the best environment for MS Windows desktop users.
44 This is an opportune point to mention that it should be borne in mind that Samba was created to
45 provide a means of interoperability and interchange of data between two operating environments
46 that are quite different. It was never the intent to make Unix/Linux like MS Windows NT. Instead
47 the purpose was an is to provide a sufficient level of exchange of data between the two environments.
48 What is available today extends well beyond early plans and expections, yet the gap continues to
53 <title>Features and Benefits</title>
56 Samba offers a lot of flexibility in file system access management. These are the key access control
57 facilities present in Samba today:
61 <title>Samba Access Control Facilities</title>
63 <emphasis>Unix File and Directory Permissions</emphasis>
67 Samba honours and implements Unix file system access controls. Users
68 who access a Samba server will do so as a particular MS Windows user.
69 This information is passed to the Samba server as part of the logon orr
70 connection setup process. Samba uses this user identity to validate
71 whether or not the user should be given access to file system resources
72 (files and directories). This chapter provides an overview for those
73 to whom the Unix permissions and controls are a little strange or unknown.
78 <emphasis>Samba Share Definitions</emphasis>
82 In configuring share settings and controls in the &smb.conf; file
83 the network administrator can exercise over-rides to native file
84 system permissions and behaviours. This can be handy and convenient
85 to affect behaviour that is more like what MS Windows NT users expect
86 but it is seldom the <emphasis>best</emphasis> way to achieve this.
87 The basic options and techniques are described herein.
92 <emphasis>Samba Share ACLs</emphasis>
96 Just like it is possible in MS Windows NT to set ACLs on shares
97 themselves, so it is possible to do this in Samba.
98 Very few people make use of this facility, yet it remains on of the
99 easiest ways to affect access controls (restrictions) and can often
100 do so with minimum invasiveness compared with other methods.
105 <emphasis>MS Windows ACLs through Unix POSIX ACLs</emphasis>
109 The use of POSIX ACLs on Unix/Linux is possible ONLY if the underlying
110 operating system supports them. If not, then this option will not be
111 available to you. Current Unix technology platforms have native support
112 for POSIX ACLs. There are patches for the Linux kernel that provide
113 this also. Sadly, few Linux paltforms ship today with native ACLs and
114 Extended Attributes enabled. This chapter has pertinent information
115 for users of platforms that support them.
123 <title>File System Access Controls</title>
126 Perhaps the most important recognition to be made is the simple fact that MS Windows NT4 / 200x / XP
127 implement a totally divergent file system technology from what is provided in the Unix operating system
128 environment. Firstly we should consider what the most significant differences are, then we shall look
129 at how Samba helps to bridge the differences.
133 <title>MS Windows NTFS Comparison with Unix File Systems</title>
136 Samba operates on top of the Unix file system. This means it is subject to Unix file system conventions
137 and permissions. It also means that if the MS Windows networking environment requires file system
138 behaviour that differs from unix file system behaviour then somehow Samba is responsible for emulating
139 that in a transparent and consistent manner.
143 It is good news that Samba does this to a very large extent and on top of that provides a high degree
144 of optional configuration to over-ride the default behaviour. We will look at some of these over-rides,
145 but for the greater part we will stay withing the bounds of default behaviour. Those wishing to explore
146 to depths of control ability should review the &smb.conf; man page.
150 <title>File System Feature Comparison</title>
152 <para><emphasis>Name Space</emphasis></para>
154 MS Windows NT4 / 200x/ XP files names may be up to 254 characters long, Unix file names
155 may be 1023 characters long. In MS Windows file extensions indicate particular file types,
156 in Unix this is not so rigorously observed as all names are considered arbitrary.
159 What MS Windows calls a Folder, Unix calls a directory,
164 <para><emphasis>Case Sensitivity</emphasis></para>
166 MS Windows file names are generally Upper Case if made up of 8.3 (ie: 8 character file name
167 and 3 character extension. If longer than 8.3 file names are Case Preserving, and Case
171 Unix file and directory names are Case Sensitive and Case Preserving. Samba implements the
172 MS Windows file name behaviour, but it does so as a user application. The Unix file system
173 provides no mechanism to perform case insensitive file name lookups. MS Windows does this
174 by default. This means that Samba has to carry the processing overhead to provide features
175 that are NOT native to the Unix operating system environment.
178 Consider the following, all are unique Unix names but one single MS Windows file name:
184 So clearly, In an MS Windows file name space these three files CAN NOT co-exist! But in Unix
185 they can. So what should Samba do if all three are present? Answer, the one that is lexically
186 first will be accessible to MS Windows users, the others are invisible and unaccessible - any
187 other solution would be suicidal.
192 <para><emphasis>Directory Separators</emphasis></para>
194 MS Windows and DOS uses the back-slash '\' as a directory delimiter, Unix uses the forward-slash '/'
195 as it's directory delimiter. This is transparently handled by Samba.
200 <para><emphasis>Drive Identification</emphasis></para>
202 MS Windows products support a notion of drive letters, like <command>C:</command> to represent
203 disk partitions. Unix has NO concept if separate identifiers for file partitions since each
204 such file system is <filename>mounted</filename> to become part of the over-all directory tree.
205 The Unix directory tree begins at '/', just like the root of a DOS drive is specified like
206 <command>C:\</command>.
211 <para><emphasis>File Naming Conventions</emphasis></para>
213 MS Windows generally never experiences file names that begin with a '.', while in Unix these
214 are commonly found in a user's home directory. Files that begin with a '.' are typically
215 either start up files for various Unix applications, or they may be files that contain
216 start-up configuration data.
221 <para><emphasis>Links and Short-Cuts</emphasis></para>
223 MS Windows make use of "links and Short-Cuts" that are actually special types of files that will
224 redirect an attempt to execute the file to the real location of the file. Unix knows of file and directory
225 links, but they are entirely different from what MS Windows users are used to.
228 Symbolic links are files in Unix that contain the actual location of the data (file OR directory). An
229 operation (like read or write) will operate directly on the file referenced. Symbolic links are also
230 referred to as 'soft links'. A hard link is something that MS Windows is NOT familiar with. It allows
231 one physical file to be known simulataneously by more than one file name.
237 There are many other subtle differences that may cause the MS Windows administrator some temporary discomfort
238 in the process of becoming familiar with Unix/Linux. These are best left for a text that is dedicated to the
239 purpose of Unix/Linux training/education.
245 <title>Managing Directories</title>
248 There are three basic operations for managing directories, <command>create, delete, rename</command>.
250 Action MS Windows Command Unix Command
251 ------ ------------------ ------------
252 create md folder mkdir folder
253 delete rd folder rmdir folder
254 rename rename oldname newname mv oldname newname
261 <title>File and Directory Access Control</title>
264 The network administrator is strongly advised to read foundational training manuals and reference materials
265 regarding file and directory permissions maintenance. Much can be achieved with the basic Unix permissions
266 without having to resort to more complex facilities like POSIX Access Control Lists (ACLs) or Extended
271 Unix/Linux file and directory access permissions invloves setting three (3) primary sets of data and one (1) control set.
272 A Unix file listing looks as follows:-
275 jht@frodo:~/stuff> ls -la
277 drwxr-xr-x 13 jht users 816 2003-05-12 22:56 .
278 drwxr-xr-x 37 jht users 3800 2003-05-12 22:29 ..
279 d--------- 2 jht users 48 2003-05-12 22:29 muchado00
280 d--x--x--x 2 jht users 48 2003-05-12 22:29 muchado01
281 dr-xr-xr-x 2 jht users 48 2003-05-12 22:29 muchado02
282 drwxrwxrwx 2 jht users 48 2003-05-12 22:29 muchado03
283 drw-rw-rw- 2 jht users 48 2003-05-12 22:29 muchado04
284 d-w--w--w- 2 jht users 48 2003-05-12 22:29 muchado05
285 dr--r--r-- 2 jht users 48 2003-05-12 22:29 muchado06
286 drwxrwxrwt 2 jht users 48 2003-05-12 22:29 muchado07
287 drwsrwsrwx 2 jht users 48 2003-05-12 22:29 muchado08
288 ---------- 1 jht users 1242 2003-05-12 22:31 mydata00.lst
289 ---x--x--x 1 jht users 1674 2003-05-12 22:33 mydata01.lst
290 --w--w--w- 1 jht users 7754 2003-05-12 22:33 mydata02.lst
291 --wx-wx-wx 1 jht users 260179 2003-05-12 22:33 mydata03.lst
292 -r--r--r-- 1 jht users 21017 2003-05-12 22:32 mydata04.lst
293 -r-xr-xr-x 1 jht users 206339 2003-05-12 22:32 mydata05.lst
294 -rw-rw-rw- 1 jht users 41105 2003-05-12 22:32 mydata06.lst
295 -rwxrwxrwx 1 jht users 19312 2003-05-12 22:32 mydata07.lst
301 The columns above represent (from left to right): permissions, no blocks used, owner, group, size (bytes), access date, access time, file name.
305 The permissions field is made up of:
308 [ type ] [ users ] [ group ] [ others ] [File, Directory Permissions]
309 [ d | l ] [ r w x ] [ r w x ] [ r w x ]
310 | | | | | | | | | | |
311 | | | | | | | | | | |-----> Can Execute, List files
312 | | | | | | | | | |-------> Can Write, Create files
313 | | | | | | | | |---------> Can Read, Read files
314 | | | | | | | |---------------> Can Execute, List files
315 | | | | | | |-----------------> Can Write, Create files
316 | | | | | |-------------------> Can Read, Read files
317 | | | | |-------------------------> Can Execute, List files
318 | | | |---------------------------> Can Write, Create files
319 | | |-----------------------------> Can Read, Read files
320 | |-----------------------------------> Is a symbolic Link
321 |---------------------------------------> Is a directory
326 Any bit flag may be unset. An unset bit flag is the equivalent of 'Can NOT' and is represented as a '-' character.
328 <title>Example File</title>
329 -rwxr-x--- Means: The owner (user) can read, write, execute
330 the group can read and execute
331 everyone else can NOT do anything with it
336 Additional posibilities in the [type] field are: c = character device, b = block device, p = pipe device, s = Unix Domain Socket.
340 The letters `rwxXst' set permissions for the user, group and others as: read (r), write (w), execute (or access for directories) (x),r
341 execute only if the file is a directory or already has execute permission for some user (X), set user or group ID on execution (s),
346 When the sticky bit is set on a directory, files in that directory may be unlinked (deleted) or renamed only by root or their owner.
347 Without the sticky bit, anyone able to write to the directory can delete or rename files. The sticky bit is commonly found on
348 directories, such as /tmp, that are world-writable.
352 When the set user or group ID bit (s) is set on a directory, then all files created within it will be owned by the user and/or
353 group whose 'set user or group' bit is set. This can be very helpful in setting up directories that for which it is desired that
354 all users who are in a group should be able to write to and read from a file, particularly when it is undesirable for that file
355 to be exclusively owned by a user who's primary group is not the group that all such users belong to.
359 When a directory is set <command>drw-r-----</command> this means that the owner can read and create (write) files in it, but because
360 the (x) execute flags are not set files can not be listed (seen) in the directory by anyone. The group can read files in the
361 directory but can NOT create new files. NOTE: If files in the directory are set to be readable and writable for the group, then
362 group members will be able to write to (or delete) them.
370 <title>Share Definition Access Controls</title>
373 Explain here about the smb.conf [share] Access Control parameters, Mode and Mask parameters, force user/group, valid/invalid users, etc.
379 <title>Access Controls on Shares</title>
382 This section deals with how to configure Samba per share access control restrictions.
383 By default samba sets no restrictions on the share itself. Restrictions on the share itself
384 can be set on MS Windows NT4/200x/XP shares. This can be a very effective way to limit who can
385 connect to a share. In the absence of specific restrictions the default setting is to allow
386 the global user <emphasis>Everyone</emphasis> Full Control (ie: Full control, Change and Read).
390 At this time Samba does NOT provide a tool for configuring access control setting on the Share
391 itself. Samba does have the capacity to store and act on access control settings, but the only
392 way to create those settings is to use either the NT4 Server Manager or the Windows 200x MMC for
397 Samba stores the per share access control settings in a file called <filename>share_info.tdb</filename>.
398 The location of this file on your system will depend on how samba was compiled. The default location
399 for samba's tdb files is under <filename>/usr/local/samba/var</filename>. If the <filename>tdbdump</filename>
400 utility has been compiled and installed on your system then you can examine the contents of this file
401 by: <userinput>tdbdump share_info.tdb</userinput>.
405 <title>Share Permissions Management</title>
408 The best tool for the task is platform dependant. Choose the best tool for your environmemt.
412 <title>Windows NT4 Workstation/Server</title>
414 The tool you need to use to manage share permissions on a Samba server is the NT Server Manager.
415 Server Manager is shipped with Windows NT4 Server products but not with Windows NT4 Workstation.
416 You can obtain the NT Server Manager for MS Windows NT4 Workstation from Microsoft - see details below.
420 <title>Instructions</title>
422 Launch the NT4 Server Manager, click on the Samba server you want to administer, then from the menu
423 select Computer, then click on the Shared Directories entry.
427 Now click on the share that you wish to manage, then click on the Properties tab, next click on
428 the Permissions tab. Now you can Add or change access control settings as you wish.
435 <title>Windows 200x/XP</title>
438 On MS Windows NT4/200x/XP system access control lists on the share itself are set using native
439 tools, usually from filemanager. For example, in Windows 200x: right click on the shared folder,
440 then select 'Sharing', then click on 'Permissions'. The default Windows NT4/200x permission allows
441 <emphasis>Everyone</emphasis> Full Control on the Share.
445 MS Windows 200x and later all comes with a tool called the 'Computer Management' snap-in for the
446 Microsoft Management Console (MMC). This tool is located by clicking on <filename>Control Panel ->
447 Administrative Tools -> Computer Management</filename>.
451 <title>Instructions</title>
453 After launching the MMC with the Computer Management snap-in, click on the menu item 'Action',
454 select 'Connect to another computer'. If you are not logged onto a domain you will be prompted
455 to enter a domain login user identifier and a password. This will authenticate you to the domain.
456 If you where already logged in with administrative privilidge this step is not offered.
460 If the Samba server is not shown in the Select Computer box, then type in the name of the target
461 Samba server in the field 'Name:'. Now click on the [+] next to 'System Tools', then on the [+]
462 next to 'Shared Folders' in the left panel.
466 Now in the right panel, double-click on the share you wish to set access control permissions on.
467 Then click on the tab 'Share Permissions'. It is now possible to add access control entities
468 to the shared folder. Do NOT forget to set what type of access (full control, change, read) you
469 wish to assign for each entry.
475 Be careful. If you take away all permissions from the Everyone user without removing this user
476 then effectively no user will be able to access the share. This is a result of what is known as
477 ACL precidence. ie: Everyone with NO ACCESS means that MaryK who is part of the group Everyone
478 will have no access even if this user is given explicit full control access.
488 <title>MS Windows Access Control Lists and Unix Interoperability</title>
491 <title>Viewing and changing UNIX permissions using the NT
492 security dialogs</title>
494 <para>Windows NT clients can use their native security settings
495 dialog box to view and modify the underlying UNIX permissions.</para>
497 <para>Note that this ability is careful not to compromise
498 the security of the UNIX host Samba is running on, and
499 still obeys all the file permission rules that a Samba
500 administrator can set.</para>
504 All access to Unix/Linux system file via Samba is controlled at
505 the operating system file access control level. When trying to
506 figure out file access problems it is vitally important to identify
507 the identity of the Windows user as it is presented by Samba at
508 the point of file access. This can best be determined from the
515 <title>How to view file security on a Samba share</title>
517 <para>From an NT4/2000/XP client, single-click with the right
518 mouse button on any file or directory in a Samba mounted
519 drive letter or UNC path. When the menu pops-up, click
520 on the <emphasis>Properties</emphasis> entry at the bottom of
521 the menu. This brings up the file properties dialog
522 box. Click on the tab <emphasis>Security</emphasis> and you
523 will see three buttons, <emphasis>Permissions</emphasis>,
524 <emphasis>Auditing</emphasis>, and <emphasis>Ownership</emphasis>.
525 The <emphasis>Auditing</emphasis> button will cause either
526 an error message <errorname>A requested privilege is not held
527 by the client</errorname> to appear if the user is not the
528 NT Administrator, or a dialog which is intended to allow an
529 Administrator to add auditing requirements to a file if the
530 user is logged on as the NT Administrator. This dialog is
531 non-functional with a Samba share at this time, as the only
532 useful button, the <command>Add</command> button will not currently
533 allow a list of users to be seen.</para>
538 <title>Viewing file ownership</title>
540 <para>Clicking on the <command>"Ownership"</command> button
541 brings up a dialog box telling you who owns the given file. The
542 owner name will be of the form :</para>
544 <para><command>"SERVER\user (Long name)"</command></para>
546 <para>Where <replaceable>SERVER</replaceable> is the NetBIOS name of
547 the Samba server, <replaceable>user</replaceable> is the user name of
548 the UNIX user who owns the file, and <replaceable>(Long name)</replaceable>
549 is the descriptive string identifying the user (normally found in the
550 GECOS field of the UNIX password database). Click on the <command>Close
551 </command> button to remove this dialog.</para>
553 <para>If the parameter <parameter>nt acl support</parameter>
554 is set to <constant>false</constant> then the file owner will
555 be shown as the NT user <command>"Everyone"</command>.</para>
557 <para>The <command>Take Ownership</command> button will not allow
558 you to change the ownership of this file to yourself (clicking on
559 it will display a dialog box complaining that the user you are
560 currently logged onto the NT client cannot be found). The reason
561 for this is that changing the ownership of a file is a privileged
562 operation in UNIX, available only to the <emphasis>root</emphasis>
563 user. As clicking on this button causes NT to attempt to change
564 the ownership of a file to the current user logged into the NT
565 client this will not work with Samba at this time.</para>
567 <para>There is an NT chown command that will work with Samba
568 and allow a user with Administrator privilege connected
569 to a Samba server as root to change the ownership of
570 files on both a local NTFS filesystem or remote mounted NTFS
571 or Samba drive. This is available as part of the <emphasis>Seclib
572 </emphasis> NT security library written by Jeremy Allison of
573 the Samba Team, available from the main Samba ftp site.</para>
578 <title>Viewing file or directory permissions</title>
580 <para>The third button is the <command>"Permissions"</command>
581 button. Clicking on this brings up a dialog box that shows both
582 the permissions and the UNIX owner of the file or directory.
583 The owner is displayed in the form :</para>
585 <para><command>"SERVER\user (Long name)"</command></para>
587 <para>Where <replaceable>SERVER</replaceable> is the NetBIOS name of
588 the Samba server, <replaceable>user</replaceable> is the user name of
589 the UNIX user who owns the file, and <replaceable>(Long name)</replaceable>
590 is the descriptive string identifying the user (normally found in the
591 GECOS field of the UNIX password database).</para>
593 <para>If the parameter <parameter>nt acl support</parameter>
594 is set to <constant>false</constant> then the file owner will
595 be shown as the NT user <command>"Everyone"</command> and the
596 permissions will be shown as NT "Full Control".</para>
599 <para>The permissions field is displayed differently for files
600 and directories, so I'll describe the way file permissions
601 are displayed first.</para>
604 <title>File Permissions</title>
606 <para>The standard UNIX user/group/world triple and
607 the corresponding "read", "write", "execute" permissions
608 triples are mapped by Samba into a three element NT ACL
609 with the 'r', 'w', and 'x' bits mapped into the corresponding
610 NT permissions. The UNIX world permissions are mapped into
611 the global NT group <command>Everyone</command>, followed
612 by the list of permissions allowed for UNIX world. The UNIX
613 owner and group permissions are displayed as an NT
614 <command>user</command> icon and an NT <command>local
615 group</command> icon respectively followed by the list
616 of permissions allowed for the UNIX user and group.</para>
618 <para>As many UNIX permission sets don't map into common
619 NT names such as <command>"read"</command>, <command>
620 "change"</command> or <command>"full control"</command> then
621 usually the permissions will be prefixed by the words <command>
622 "Special Access"</command> in the NT display list.</para>
624 <para>But what happens if the file has no permissions allowed
625 for a particular UNIX user group or world component ? In order
626 to allow "no permissions" to be seen and modified then Samba
627 overloads the NT <command>"Take Ownership"</command> ACL attribute
628 (which has no meaning in UNIX) and reports a component with
629 no permissions as having the NT <command>"O"</command> bit set.
630 This was chosen of course to make it look like a zero, meaning
631 zero permissions. More details on the decision behind this will
632 be given below.</para>
636 <title>Directory Permissions</title>
638 <para>Directories on an NT NTFS file system have two
639 different sets of permissions. The first set of permissions
640 is the ACL set on the directory itself, this is usually displayed
641 in the first set of parentheses in the normal <command>"RW"</command>
642 NT style. This first set of permissions is created by Samba in
643 exactly the same way as normal file permissions are, described
644 above, and is displayed in the same way.</para>
646 <para>The second set of directory permissions has no real meaning
647 in the UNIX permissions world and represents the <command>
648 "inherited"</command> permissions that any file created within
649 this directory would inherit.</para>
651 <para>Samba synthesises these inherited permissions for NT by
652 returning as an NT ACL the UNIX permission mode that a new file
653 created by Samba on this share would receive.</para>
658 <title>Modifying file or directory permissions</title>
660 <para>Modifying file and directory permissions is as simple
661 as changing the displayed permissions in the dialog box, and
662 clicking the <command>OK</command> button. However, there are
663 limitations that a user needs to be aware of, and also interactions
664 with the standard Samba permission masks and mapping of DOS
665 attributes that need to also be taken into account.</para>
667 <para>If the parameter <parameter>nt acl support</parameter>
668 is set to <constant>false</constant> then any attempt to set
669 security permissions will fail with an <command>"Access Denied"
670 </command> message.</para>
672 <para>The first thing to note is that the <command>"Add"</command>
673 button will not return a list of users in Samba (it will give
674 an error message of <command>"The remote procedure call failed
675 and did not execute"</command>). This means that you can only
676 manipulate the current user/group/world permissions listed in
677 the dialog box. This actually works quite well as these are the
678 only permissions that UNIX actually has.</para>
680 <para>If a permission triple (either user, group, or world)
681 is removed from the list of permissions in the NT dialog box,
682 then when the <command>"OK"</command> button is pressed it will
683 be applied as "no permissions" on the UNIX side. If you then
684 view the permissions again the "no permissions" entry will appear
685 as the NT <command>"O"</command> flag, as described above. This
686 allows you to add permissions back to a file or directory once
687 you have removed them from a triple component.</para>
689 <para>As UNIX supports only the "r", "w" and "x" bits of
690 an NT ACL then if other NT security attributes such as "Delete
691 access" are selected then they will be ignored when applied on
692 the Samba server.</para>
694 <para>When setting permissions on a directory the second
695 set of permissions (in the second set of parentheses) is
696 by default applied to all files within that directory. If this
697 is not what you want you must uncheck the <command>"Replace
698 permissions on existing files"</command> checkbox in the NT
699 dialog before clicking <command>"OK"</command>.</para>
701 <para>If you wish to remove all permissions from a
702 user/group/world component then you may either highlight the
703 component and click the <command>"Remove"</command> button,
704 or set the component to only have the special <command>"Take
705 Ownership"</command> permission (displayed as <command>"O"
706 </command>) highlighted.</para>
710 <title>Interaction with the standard Samba create mask
713 <para>There are four parameters
714 to control interaction with the standard Samba create mask parameters.
717 <para><parameter>security mask</parameter></para>
718 <para><parameter>force security mode</parameter></para>
719 <para><parameter>directory security mask</parameter></para>
720 <para><parameter>force directory security mode</parameter></para>
722 <para>Once a user clicks <command>"OK"</command> to apply the
723 permissions Samba maps the given permissions into a user/group/world
724 r/w/x triple set, and then will check the changed permissions for a
725 file against the bits set in the <ulink url="smb.conf.5.html#SECURITYMASK">
726 <parameter>security mask</parameter></ulink> parameter. Any bits that
727 were changed that are not set to '1' in this parameter are left alone
728 in the file permissions.</para>
730 <para>Essentially, zero bits in the <parameter>security mask</parameter>
731 mask may be treated as a set of bits the user is <emphasis>not</emphasis>
732 allowed to change, and one bits are those the user is allowed to change.
735 <para>If not set explicitly this parameter is set to the same value as
736 the <ulink url="smb.conf.5.html#CREATEMASK"><parameter>create mask
737 </parameter></ulink> parameter. To allow a user to modify all the
738 user/group/world permissions on a file, set this parameter
741 <para>Next Samba checks the changed permissions for a file against
742 the bits set in the <ulink url="smb.conf.5.html#FORCESECURITYMODE">
743 <parameter>force security mode</parameter></ulink> parameter. Any bits
744 that were changed that correspond to bits set to '1' in this parameter
745 are forced to be set.</para>
747 <para>Essentially, bits set in the <parameter>force security mode
748 </parameter> parameter may be treated as a set of bits that, when
749 modifying security on a file, the user has always set to be 'on'.</para>
751 <para>If not set explicitly this parameter is set to the same value
752 as the <ulink url="smb.conf.5.html#FORCECREATEMODE"><parameter>force
753 create mode</parameter></ulink> parameter.
754 To allow a user to modify all the user/group/world permissions on a file
755 with no restrictions set this parameter to 000.</para>
757 <para>The <parameter>security mask</parameter> and <parameter>force
758 security mode</parameter> parameters are applied to the change
759 request in that order.</para>
761 <para>For a directory Samba will perform the same operations as
762 described above for a file except using the parameter <parameter>
763 directory security mask</parameter> instead of <parameter>security
764 mask</parameter>, and <parameter>force directory security mode
765 </parameter> parameter instead of <parameter>force security mode
768 <para>The <parameter>directory security mask</parameter> parameter
769 by default is set to the same value as the <parameter>directory mask
770 </parameter> parameter and the <parameter>force directory security
771 mode</parameter> parameter by default is set to the same value as
772 the <parameter>force directory mode</parameter> parameter. </para>
774 <para>In this way Samba enforces the permission restrictions that
775 an administrator can set on a Samba share, whilst still allowing users
776 to modify the permission bits within that restriction.</para>
778 <para>If you want to set up a share that allows users full control
779 in modifying the permission bits on their files and directories and
780 doesn't force any particular bits to be set 'on', then set the following
781 parameters in the &smb.conf; file in that share specific section :</para>
783 <para><parameter>security mask = 0777</parameter></para>
784 <para><parameter>force security mode = 0</parameter></para>
785 <para><parameter>directory security mask = 0777</parameter></para>
786 <para><parameter>force directory security mode = 0</parameter></para>
790 <title>Interaction with the standard Samba file attribute
793 <para>Samba maps some of the DOS attribute bits (such as "read
794 only") into the UNIX permissions of a file. This means there can
795 be a conflict between the permission bits set via the security
796 dialog and the permission bits set by the file attribute mapping.
799 <para>One way this can show up is if a file has no UNIX read access
800 for the owner it will show up as "read only" in the standard
801 file attributes tabbed dialog. Unfortunately this dialog is
802 the same one that contains the security info in another tab.</para>
804 <para>What this can mean is that if the owner changes the permissions
805 to allow themselves read access using the security dialog, clicks
806 <command>"OK"</command> to get back to the standard attributes tab
807 dialog, and then clicks <command>"OK"</command> on that dialog, then
808 NT will set the file permissions back to read-only (as that is what
809 the attributes still say in the dialog). This means that after setting
810 permissions and clicking <command>"OK"</command> to get back to the
811 attributes dialog you should always hit <command>"Cancel"</command>
812 rather than <command>"OK"</command> to ensure that your changes
813 are not overridden.</para>
818 <title>Common Errors</title>
821 Stuff from mailing lists here