12.5 MS Windows Access Control Lists and UNIX Interoperability


12.5.1 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.

This ability is careful not to compromise the security of the UNIX host on which Samba is running, and still obeys all the file permission rules that a Samba administrator can set.

Samba does not attempt to go beyond POSIX ACLs, so the various finer-grained access control options provided in Windows are actually ignored.

N OTE

graphics/round_pencil.gif

All access to UNIX/Linux system files via Samba is controlled by the operating system file access controls. When trying to figure out file access problems, it is vitally important to find the identity of the Windows user as it is presented by Samba at the point of file access. This can best be determined from the Samba log files.


12.5.2 Viewing File Security on a Samba Share

From an NT4/2000/XP client, right click 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 the menu. This brings up the file Properties dialog box. Click on the Security tab and you will see three buttons : Permissions, Auditing , and Ownership . The Auditing button will cause either an error message 'A requested privilege is not held by the client' to appear if the user is not the NT Administrator, or a dialog which is intended to allow an Administrator to add auditing requirements to a file if the user is logged on as the NT Administrator. This dialog is non-functional with a Samba share at this time, as the only useful button, the Add button, will not currently allow a list of users to be seen.

12.5.3 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 displayed like this:

"SERVER\user (Long name) "

SERVER is the NetBIOS name of the Samba server, user is the user name of the UNIX user who owns the file, and (Long name) is the descriptive string identifying the user (normally found in the GECOS field of the UNIX password database). Click on the Close button to remove this dialog.

If the parameter nt acl support is set to false , the file owner will be shown as the NT user Everyone .

The Take Ownership button will not allow you to change the ownership of this file to yourself (clicking it will display a dialog box complaining that the user you are currently logged onto the NT client cannot be found). The reason for this is that changing the ownership of a file is a privileged operation in UNIX, available only to the root user. As clicking on this button causes NT to attempt to change the ownership of a file to the current user logged into the NT clienti, this will not work with Samba at this time.

There is an NT chown command that will work with Samba and allow a user with Administrator privilege connected to a Samba server as root to change the ownership of files on both a local NTFS filesystem or remote mounted NTFS or Samba drive. This is available as part of the Seclib NT security library written by Jeremy Allison of the Samba Team, and is available from the main Samba FTP site.

12.5.4 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 like this:

 
  SERVER\user (Long name)  

Where SERVER is the NetBIOS name of the Samba server, user is the user name of the UNIX user who owns the file, and ( Long name ) is the descriptive string identifying the user (normally found in the GECOS field of the UNIX password database).

If the parameter nt acl support is set to false , the file owner will be shown as the NT user 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.

12.5.4.1 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 NT permissions. The UNIX world permissions are mapped into the global NT group Everyone , followed by the list of permissions allowed for UNIX world. The UNIX owner and group permissions are displayed as an NT user icon and an NT local group icon, respectively, followed by the list of permissions allowed for the UNIX user and group.

Because many UNIX permission sets do not map into common NT names such as read , change or full control , usually the permissions will be prefixed by the words Special Access in the NT display list.

But what happens if the file has no permissions allowed for a particular UNIX user group or world component? In order to allow " no permissions " to be seen and modified Samba then overloads the NT Take Ownership ACL attribute (which has no meaning in UNIX) and reports a component with no permissions as having the NT 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 is given below.

12.5.4.2 Directory Permissions

Directories on an NT NTFS file system have two different sets of permissions. The first set is the ACL set on the directory itself, which is usually displayed in the first set of parentheses in the normal RW NT style. This first set of permissions is created by Samba in exactly the same way as normal file permissions are, described above, and is displayed in the same way.

The second set of directory permissions has no real meaning in the UNIX permissions world and represents the inherited 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.

12.5.5 Modifying File or Directory Permissions

Modifying file and directory permissions is as simple as changing the displayed permissions in the dialog box, and clicking on OK . However, there are limitations that a user needs to be aware of, and also interactions with the standard Samba permission masks and mapping of DOS attributes that need to also be taken into account.

If the parameter nt acl support is set to false , any attempt to set security permissions will fail with an 'Access Denied' message.

The first thing to note is that the Add button will not return a list of users in Samba (it will give an error message saying 'The remote procedure call failed and did not execute'). This means that you can only manipulate the current user/group/world permissions listed in the dialog box. This actually works quite well as these are the only permissions that UNIX actually has.

If a permission triplet (either user, group, or world) is removed from the list of permissions in the NT dialog box, then when the OK button is pressed it will be applied as " no permissions " on the UNIX side. If you then view the permissions again, the " no permissions " entry will appear as the NT O flag, as described above. This allows you to add permissions back to a file or directory once you have removed them from a triplet component.

As UNIX supports only the " r ", " w " and " x " bits of an NT ACL, if other NT security attributes such as Delete Access are selected they will be ignored when applied on the Samba server.

When setting permissions on a directory, the second set of permissions (in the second set of parentheses) is by default applied to all files within that directory. If this is not what you want, you must uncheck the Replace permissions on existing files checkbox in the NT dialog before clicking on OK .

If you wish to remove all permissions from a user/group/world component, you may either highlight the component and click on the Remove button, or set the component to only have the special Take Ownership permission (displayed as O ) highlighted.

12.5.6 Interaction with the Standard Samba " create mask " Parameters

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

  • security mask

  • force security mode

  • directory security mask

  • force directory security mode

Once a user clicks on OK to apply the permissions, Samba maps the given permissions into a user/group/world r/w/x triplet set, and then checks the changed permissions for a file against the bits set in the security mask parameter. Any bits that were changed that are not set to " 1 " in this parameter are left alone in the file permissions.

Essentially, zero bits in the security mask may be treated as a set of bits the user is not allowed to change, and one bits are those the user is allowed to change.

If not explicitly set, this parameter defaults to the same value as the create mask parameter. To allow a user to modify all the user/group/world permissions on a file, set this parameter to 0777.

Next Samba checks the changed permissions for a file against the bits set in the force security mode parameter. Any bits that were changed that correspond to bits set to " 1 " in this parameter are forced to be set.

Essentially, bits set in the force security mode parameter may be treated as a set of bits that, when modifying security on a file, the user has always set to be " on ".

If not explicitly set, this parameter defaults to the same value as the force create mode parameter. To allow a user to modify all the user/group/world permissions on a file with no restrictions set this parameter to 000. The security mask and force security mode parameters are applied to the change request in that order.

For a directory, Samba will perform the same operations as described above for a file except it uses the parameter directory security mask instead of security mask , and force directory security mode parameter instead of force security mode .

The directory security mask parameter by default is set to the same value as the directory mask parameter and the force directory security mode parameter by default is set to the same value as the force directory mode parameter. In this way Samba enforces the permission restrictions that an administrator can set on a Samba share, while still allowing users to modify the permission bits within that restriction.

If you want to set up a share that allows users full control in modifying the permission bits on their files and directories and does not force any particular bits to be set " on ", then set the following parameters in the smb.conf file in that share-specific section:

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

12.5.7 Interaction with the Standard Samba File Attribute Mapping

N OTE

graphics/round_pencil.gif

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 dialog and the permission bits set by the file attribute mapping.


If a file has no UNIX read access for the owner, it will show up as " read only " in the standard file attributes tabbed dialog. Unfortunately, this dialog is the same one that contains the security information in another tab.

What this can mean is that if the owner changes the permissions to allow himself read access using the security dialog, clicks on OK to get back to the standard attributes tab dialog, and clicks on OK on that dialog, then NT will set the file permissions back to read-only (as that is what the attributes still say in the dialog). This means that after setting permissions and clicking on OK to get back to the attributes dialog, you should always press Cancel rather than OK to ensure that your changes are not overridden.



Official Samba-3 HOWTO and Reference Guide
The Official Samba-3 HOWTO and Reference Guide, 2nd Edition
ISBN: 0131882228
EAN: 2147483647
Year: 2005
Pages: 297

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net