From ca9384623054fde64510edfbee3fc291f1d09fb9 Mon Sep 17 00:00:00 2001 From: John Terpstra Date: Wed, 16 Jul 2003 05:42:10 +0000 Subject: Documentation Update for Beta3. (This used to be commit a88dc502cb3b6b2d905106675f50680bf22e2cfa) --- docs/htmldocs/AccessControls.html | 153 +++++++++++++++++++------------------- 1 file changed, 77 insertions(+), 76 deletions(-) (limited to 'docs/htmldocs/AccessControls.html') diff --git a/docs/htmldocs/AccessControls.html b/docs/htmldocs/AccessControls.html index 044d347107..3b89cb22d0 100644 --- a/docs/htmldocs/AccessControls.html +++ b/docs/htmldocs/AccessControls.html @@ -1,6 +1,7 @@ -Chapter 13. File, Directory and Share Access Controls

Chapter 13. File, Directory and Share Access Controls

John H. Terpstra

Samba Team

Jeremy Allison

Samba Team

May 10, 2003

Table of Contents

Features and Benefits
File System Access Controls
MS Windows NTFS Comparison with Unix File Systems
Managing Directories
File and Directory Access Control
Share Definition Access Controls
User and Group Based Controls
File and Directory Permissions Based Controls
Miscellaneous Controls
Access Controls on Shares
Share Permissions Management
MS Windows Access Control Lists and Unix Interoperability
Managing UNIX permissions Using NT Security Dialogs
Viewing File Security on a Samba Share
Viewing file ownership
Viewing File or Directory Permissions
Modifying file or directory permissions
Interaction with the standard Samba create mask - parameters
Interaction with the standard Samba file attribute - mapping
Common Errors
Users can not write to a public share
I have set force user and Samba still makes root the owner of all the files + +Chapter 13. File, Directory and Share Access Controls

Chapter 13. File, Directory and Share Access Controls

John H. Terpstra

Samba Team

Jeremy Allison

Samba Team

May 10, 2003

Advanced MS Windows users are frequently perplexed when file, directory and share manipulation of resources shared via Samba do not behave in the manner they might expect. MS Windows network @@ -32,7 +33,7 @@ that are quite different. It was never the intent to make Unix/Linux like MS Win the purpose was an is to provide a sufficient level of exchange of data between the two environments. What is available today extends well beyond early plans and expectations, yet the gap continues to shrink. -

Features and Benefits

+

Features and Benefits

Samba offers a lot of flexibility in file system access management. These are the key access control facilities present in Samba today:

Samba Access Control Facilities

  • @@ -72,12 +73,12 @@ shrink. this also. Sadly, few Linux platforms ship today with native ACLs and Extended Attributes enabled. This chapter has pertinent information for users of platforms that support them. -

File System Access Controls

+

File System Access Controls

Perhaps the most important recognition to be made is the simple fact that MS Windows NT4 / 200x / XP implement a totally divergent file system technology from what is provided in the Unix operating system environment. Firstly we should consider what the most significant differences are, then we shall look at how Samba helps to bridge the differences. -

MS Windows NTFS Comparison with Unix File Systems

+

MS Windows NTFS Comparison with Unix File Systems

Samba operates on top of the Unix file system. This means it is subject to Unix file system conventions and permissions. It also means that if the MS Windows networking environment requires file system behaviour that differs from unix file system behaviour then somehow Samba is responsible for emulating @@ -141,19 +142,19 @@ at how Samba helps to bridge the differences. There are many other subtle differences that may cause the MS Windows administrator some temporary discomfort in the process of becoming familiar with Unix/Linux. These are best left for a text that is dedicated to the purpose of Unix/Linux training/education. -

Managing Directories

+

Managing Directories

There are three basic operations for managing directories, create, delete, rename. -

Table 13.1. Managing directories with unix and windows

ActionMS Windows CommandUnix Command
createmd foldermkdir folder
deleterd folderrmdir folder
renamerename oldname newnamemv oldname newname

-

File and Directory Access Control

+

Table 13.1. Managing directories with unix and windows

ActionMS Windows CommandUnix Command
createmd foldermkdir folder
deleterd folderrmdir folder
renamerename oldname newnamemv oldname newname
+

File and Directory Access Control

The network administrator is strongly advised to read foundational training manuals and reference materials regarding file and directory permissions maintenance. Much can be achieved with the basic Unix permissions without having to resort to more complex facilities like POSIX Access Control Lists (ACLs) or Extended Attributes (EAs). -

+

Unix/Linux file and directory access permissions involves setting three (3) primary sets of data and one (1) control set. A Unix file listing looks as follows:- -

+	
 	jht@frodo:~/stuff> ls -la
 	total 632
 	drwxr-xr-x   13 jht   users      816 2003-05-12 22:56 .
@@ -176,13 +177,13 @@ at how Samba helps to bridge the differences.
 	-rw-rw-rw-    1 jht   users    41105 2003-05-12 22:32 mydata06.lst
 	-rwxrwxrwx    1 jht   users    19312 2003-05-12 22:32 mydata07.lst
 	jht@frodo:~/stuff>
-	

-

+

+

The columns above represent (from left to right): permissions, no blocks used, owner, group, size (bytes), access date, access time, file name. -

+

The permissions field is made up of: -

+	
 	 JRV: Put this into a diagram of some sort
 	[ type  ] [ users ] [ group ] [ others ]   [File, Directory Permissions]
 	[ d | l ] [ r w x ] [ r w x ] [ r w x  ]
@@ -198,17 +199,17 @@ at how Samba helps to bridge the differences.
 	  |   |     |-----------------------------> Can Read,    Read files
 	  |   |-----------------------------------> Is a symbolic Link
 	  |---------------------------------------> Is a directory
-	

-

+

+ Any bit flag may be unset. An unset bit flag is the equivalent of 'Can NOT' and is represented as a '-' character. -

Example 13.1. Example File

+	

Example 13.1. Example File

 		-rwxr-x---   Means: The owner (user) can read, write, execute
 		                    the group can read and execute
 		                    everyone else can NOT do anything with it
-		

+

-

+

Additional possibilities in the [type] field are: c = character device, b = block device, p = pipe device, s = Unix Domain Socket.

The letters `rwxXst' set permissions for the user, group and others as: read (r), write (w), execute (or access for directories) (x), @@ -228,10 +229,10 @@ at how Samba helps to bridge the differences. 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 directory but can NOT create new files. NOTE: If files in the directory are set to be readable and writable for the group, then group members will be able to write to (or delete) them. -

Share Definition Access Controls

+

Share Definition Access Controls

The following parameters in the smb.conf file sections that define a share control or affect access controls. Before using any of the following options please refer to the man page for smb.conf. -

User and Group Based Controls

+

User and Group Based Controls

User and group based controls can prove very useful. In some situations it is distinctly desirable to affect all file system operations as if a single user is doing this, the use of the force user and force group behaviour will achieve this. In other situations it may be necessary to affect a @@ -243,7 +244,7 @@ Before using any of the following options please refer to the man page for

Table 13.2. User and Group Based Controls

Control ParameterDescription - Action - Notes
admin users

+

Table 13.2. User and Group Based Controls

Control ParameterDescription - Action - Notes
admin users

List of users who will be granted administrative privileges on the share. They will do all file operations as the super-user (root). Any user in this list will be able to do anything they like on the share, @@ -270,12 +271,12 @@ Before using any of the following options please refer to the man page for

write list

List of users that are given read-write access to a service. -

File and Directory Permissions Based Controls

+

File and Directory Permissions Based Controls

The following file and directory permission based controls, if misused, can result in considerable difficulty to diagnose the cause of mis-configuration. Use them sparingly and carefully. By gradually introducing each one by one undesirable side-effects may be detected. In the event of a problem, always comment all of them out and then gradually re-introduce them in a controlled fashion. -

Table 13.3. File and Directory Permission Based Controls

Control ParameterDescription - Action - Notes
create mask

+

Table 13.3. File and Directory Permission Based Controls

Control ParameterDescription - Action - Notes
create mask

Refer to the smb.conf man page.

directory mask

The octal modes used when converting DOS modes to UNIX modes when creating UNIX directories. @@ -298,10 +299,10 @@ Before using any of the following options please refer to the man page for

security mask

Controls UNIX permission bits modified when a Windows NT client is manipulating the UNIX permissions on a file. -

Miscellaneous Controls

+

Miscellaneous Controls

The following are documented because of the prevalence of administrators creating inadvertant barriers to file access by not understanding the full implications of smb.conf file settings. -

Table 13.4. Other Controls

Control ParameterDescription - Action - Notes
case sensitive, default case, short preserve case

+

Table 13.4. Other Controls

Control ParameterDescription - Action - Notes
case sensitive, default case, short preserve case

This means that all file name lookup will be done in a case sensitive manner. Files will be created with the precise filename Samba received from the MS Windows client.

csc policy

@@ -322,7 +323,7 @@ Before using any of the following options please refer to the man page for

veto files

List of files and directories that are neither visible nor accessible. -

Access Controls on Shares

+

Access Controls on Shares

This section deals with how to configure Samba per share access control restrictions. By default, Samba sets no restrictions on the share itself. Restrictions on the share itself can be set on MS Windows NT4/200x/XP shares. This can be a very effective way to limit who can @@ -339,9 +340,9 @@ Before using any of the following options please refer to the man page for /usr/local/samba/var. If the tdbdump utility has been compiled and installed on your system, then you can examine the contents of this file by: tdbdump share_info.tdb. -

Share Permissions Management

+

Share Permissions Management

The best tool for the task is platform dependant. Choose the best tool for your environment. -

Windows NT4 Workstation/Server

+

Windows NT4 Workstation/Server

The tool you need to use to manage share permissions on a Samba server is the NT Server Manager. Server Manager is shipped with Windows NT4 Server products but not with Windows NT4 Workstation. You can obtain the NT Server Manager for MS Windows NT4 Workstation from Microsoft - see details below. @@ -351,7 +352,7 @@ Before using any of the following options please refer to the man page for

  • Now click on the share that you wish to manage, then click on the Properties tab, next click on the Permissions tab. Now you can add or change access control settings as you wish. -

  • Windows 200x/XP

    +

    Windows 200x/XP

    On MS Windows NT4/200x/XP system access control lists on the share itself are set using native tools, usually from filemanager. For example, in Windows 200x: right click on the shared folder, then select Sharing, then click on Permissions. The default @@ -380,7 +381,7 @@ Before using any of the following options please refer to the man page for no access means that MaryK who is part of the group Everyone will have no access even if this user is given explicit full control access. -

    MS Windows Access Control Lists and Unix Interoperability

    Managing UNIX permissions Using NT Security Dialogs

    Windows NT clients can use their native security settings +

    MS Windows Access Control Lists and Unix Interoperability

    Managing UNIX permissions Using NT Security Dialogs

    Windows NT clients can use their native security settings dialog box to view and modify the underlying UNIX permissions.

    Note that this ability is careful not to compromise the security of the UNIX host Samba is running on, and still obeys all the file permission rules that a Samba @@ -391,7 +392,7 @@ Before using any of the following options please refer to the man page for

    Viewing File Security on a Samba Share

    From an NT4/2000/XP client, single-click with the right +

    Viewing File Security on a Samba Share

    From an NT4/2000/XP client, single-click with the right mouse button on any file or directory in a Samba mounted drive letter or UNC path. When the menu pops-up, click on the Properties entry at the bottom of @@ -407,7 +408,7 @@ Before using any of the following options please refer to the man page for Add button will not currently - allow a list of users to be seen.

    Viewing file ownership

    Clicking on the Ownership button + allow a list of users to be seen.

    Viewing file ownership

    Clicking on the Ownership button brings up a dialog box telling you who owns the given file. The owner name will be of the form :

    "SERVER\user (Long name)"

    Where SERVER is the NetBIOS name of the Samba server, user is the user name of @@ -430,7 +431,7 @@ Before using any of the following options please refer to the man page for Seclib NT security library written by Jeremy Allison of - the Samba Team, available from the main Samba ftp site.

    Viewing File or Directory Permissions

    The third button is the Permissions + the Samba Team, available from the main Samba ftp site.

    Viewing File or Directory Permissions

    The third button is the Permissions button. Clicking on this brings up a dialog box that shows both the permissions and the UNIX owner of the file or directory. The owner is displayed in the form :

    "SERVER\ @@ -444,7 +445,7 @@ Before using any of the following options please refer to the man page for "Everyone" and the permissions will be shown as NT "Full Control".

    The permissions field is displayed differently for files and directories, so I'll describe the way file permissions - are displayed first.

    File Permissions

    The standard UNIX user/group/world triplet and + are displayed first.

    File Permissions

    The standard UNIX user/group/world triplet and the corresponding "read", "write", "execute" permissions triplets are mapped by Samba into a three element NT ACL with the 'r', 'w', and 'x' bits mapped into the corresponding @@ -466,7 +467,7 @@ Before using any of the following options please refer to the man page for "O" bit set. This was chosen of course to make it look like a zero, meaning zero permissions. More details on the decision behind this will - be given below.

    Directory Permissions

    Directories on an NT NTFS file system have two + be given below.

    Directory Permissions

    Directories on an NT NTFS file system have two different sets of permissions. The first set of permissions is the ACL set on the directory itself, this is usually displayed in the first set of parentheses in the normal "RW" @@ -477,7 +478,7 @@ Before using any of the following options please refer to the man page for permissions that any file created within this directory would inherit.

    Samba synthesises these inherited permissions for NT by returning as an NT ACL the UNIX permission mode that a new file - created by Samba on this share would receive.

    Modifying file or directory permissions

    Modifying file and directory permissions is as simple + created by Samba on this share would receive.

    Modifying file or directory permissions

    Modifying file and directory permissions is as simple as changing the displayed permissions in the dialog box, and clicking the OK button. However, there are limitations that a user needs to be aware of, and also interactions @@ -511,14 +512,14 @@ Before using any of the following options please refer to the man page for Remove button, or set the component to only have the special Take Ownership permission (displayed as "O" - ) highlighted.

    Interaction with the standard Samba create mask - parameters

    There are four parameters + ) highlighted.

    Interaction with the standard Samba create mask + parameters

    There are four parameters to control interaction with the standard Samba create mask parameters. These are : -

    security mask
    force security mode
    directory security mask
    force directory security mode

    +
    security mask
    force security mode
    directory security mask
    force directory security mode
    -

    Once a user clicks OK to apply the +

    Once a user clicks OK to apply the permissions Samba maps the given permissions into a user/group/world r/w/x triplet set, and then will check the changed permissions for a file against the bits set in the @@ -558,7 +559,7 @@ Before using any of the following options please refer to the man page for smb.conf file in that share specific section : -

    security mask = 0777
    force security mode = 0
    directory security mask = 0777
    force directory security mode = 0

    Interaction with the standard Samba file attribute +

    security mask = 0777
    force security mode = 0
    directory security mask = 0777
    force directory security mode = 0

    Interaction with the standard Samba file attribute mapping

    Samba maps some of the DOS attribute bits (such as "read only") into the UNIX permissions of a file. This means there can be a conflict between the permission bits set via the security @@ -575,10 +576,10 @@ Before using any of the following options please refer to the man page for OK to get back to the attributes dialog you should always hit Cancel rather than OK to ensure that your changes - are not overridden.

    Common Errors

    + are not overridden.

    Common Errors

    File, Directory and Share access problems are very common on the mailing list. The following are examples taken from the mailing list in recent times. -

    Users can not write to a public share

    +

    Users can not write to a public share

    We are facing some troubles with file / directory permissions. I can log on the domain as admin user(root), and there's a public share, on which everyone needs to have permission to create / modify files, but only @@ -589,71 +590,71 @@ are examples taken from the mailing list in recent times. There are many ways to solve this problem, here are a few hints:

    Procedure 13.3. Example Solution:

    1. Go to the top of the directory that is shared -

    2. +

    3. Set the ownership to what ever public owner and group you want -

      +			
       			find 'directory_name' -type d -exec chown user.group {}\;
       			find 'directory_name' -type d -exec chmod 6775 'directory_name'
       			find 'directory_name' -type f -exec chmod 0775 {} \;
       			find 'directory_name' -type f -exec chown user.group {}\;
      -			

      -

      Note

      +

      +

      Note

      The above will set the 'sticky bit' on all directories. Read your Unix/Linux man page on what that does. It causes the OS to assign to all files created in the directories the ownership of the directory. -

    4. +

  • Directory is: /foodbar -

    +			
     				$ chown jack.engr /foodbar
    -			

    -

    Note

    -

    This is the same as doing:

    -

    +			
    +

    Note

    +

    This is the same as doing:

    +
     					$ chown jack /foodbar
     					$ chgrp engr /foodbar
    -				

    -

  • Now do: + +

  • Now do: -

    +			
     				$ chmod 6775 /foodbar
     				$ ls -al /foodbar/..
    -			

    +

    -

    You should see: -

    +			You should see:
    +			
     				drwsrwsr-x  2 jack  engr    48 2003-02-04 09:55 foodbar
    -			

    -

  • Now do: -

    +			
    +
  • Now do: +
     				$ su - jill
     				$ cd /foodbar
     				$ touch Afile
     				$ ls -al
    -			

    -

    + + You should see that the file Afile created by Jill will have ownership and permissions of Jack, as follows: -

    +		
     		-rw-r--r--  1 jack  engr     0 2003-02-04 09:57 Afile
    -		

    -

  • + +

  • Now in your smb.conf for the share add: -

    +		
     		force create mode = 0775
     		force directory mode = 6775
    -		

    -

    Note

    +

    +

    Note

    The above are only needed if your users are not members of the group you have used. ie: Within the OS do not have write permission on the directory. -

    +

  • An alternative is to set in the smb.conf entry for the share: -

    +		
     		force user = jack
     		force group = engr
    -		

    -

    I have set force user and Samba still makes root the owner of all the files + +

    I have set force user and Samba still makes root the owner of all the files I touch!

    When you have a user in 'admin users', Samba will always do file operations for this user as root, even if force user has been set. -- cgit