Software: Apache/2.0.54 (Fedora). PHP/5.0.4 uname -a: Linux mina-info.me 2.6.17-1.2142_FC4smp #1 SMP Tue Jul 11 22:57:02 EDT 2006 i686 uid=48(apache) gid=48(apache) groups=48(apache) Safe-mode: OFF (not secure) /usr/bin/X11/./../../share/doc/MySQL-python-1.2.0/../samba-3.0.23a/htmldocs/Samba3-HOWTO/ drwxr-xr-x |
Viewing file: Select action/file-type: Table of Contents
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 administrators are often confused regarding network access controls and how to provide users with the access they need while protecting resources from unauthorized access. Many UNIX administrators are unfamiliar with the MS Windows environment and in particular have difficulty in visualizing what the MS Windows user wishes to achieve in attempts to set file and directory access permissions. The problem lies in the differences in how file and directory permissions and controls work between the two environments. This difference is one that Samba cannot completely hide, even though it does try to bridge the chasm to a degree. POSIX Access Control List technology has been available (along with extended attributes) for UNIX for many years, yet there is little evidence today of any significant use. This explains to some extent the slow adoption of ACLs into commercial Linux products. MS Windows administrators are astounded at this, given that ACLs were a foundational capability of the now decade-old MS Windows NT operating system. The purpose of this chapter is to present each of the points of control that are possible with Samba-3 in the hope that this will help the network administrator to find the optimum method for delivering the best environment for MS Windows desktop users. This is an opportune point to mention that Samba was created to provide a means of interoperability and interchange of data between differing operating environments. Samba has no intent to change UNIX/Linux into a platform like MS Windows. Instead the purpose was and 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. Samba offers much flexibility in file system access management. These are the key access control facilities present in Samba today: Samba Access Control Facilities
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. First we consider what the most significant differences are, then we look at how Samba helps to bridge the differences. 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 behavior, that differs from UNIX file system behavior then somehow Samba is responsible for emulating that in a transparent and consistent manner.
It is good news that Samba does this to a large extent, and on top of that, provides a high degree
of optional configuration to override the default behavior. We look at some of these overrides,
but for the greater part we stay within the bounds of default behavior. Those wishing to explore
the depths of control ability should review the The following compares file system features for UNIX with those of MS Windows NT/200x:
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 and education. There are three basic operations for managing directories: create, delete, rename. Managing Directories with UNIX and Windows compares the commands in Windows and UNIX that implement these operations. The network administrator is strongly advised to read basic UNIX 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 ACLs or extended attributes (EAs). UNIX/Linux file and directory access permissions involves setting three primary sets of data and one control set. A UNIX file listing looks as follows:
The columns represent (from left to right) permissions, number of hard links to file, owner, group, size (bytes), access date, time of last modification, and file name. An overview of the permissions field is shown in Overview of UNIX permissions field. Any bit flag may be unset. An unset bit flag is the equivalent of "cannot" and is represented as a “-” character (see ???) Example 16.1. Example File -rwxr-x--- Means: ^^^ The owner (user) can read, write, execute ^^^ the group can read and execute ^^^ everyone else cannot 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
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.
Without the sticky bit, anyone able to write to the directory can delete or rename files. The sticky bit is commonly found on
directories, such as 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 group whose `set user or group' bit is set. This can be helpful in setting up directories for which it is desired that 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 to be exclusively owned by a user whose primary group is not the group that all such users belong to.
When a directory is set People have asked on the Samba mailing list how is it possible to protect files or directories from deletion by users. For example, Windows NT/2K/XP provides the capacity to set access controls on a directory into which people can write files but not delete them. It is possible to set an ACL on a Windows file that permits the file to be written to but not deleted. Such concepts are foreign to the UNIX operating system file space. Within the UNIX file system anyone who has the ability to create a file can write to it. Anyone who has write permission on the directory that contains a file and has write permission for it has the capability to delete it. For the record, in the UNIX environment the ability to delete a file is controlled by the permissions on the directory that the file is in. In other words, a user can delete a file in a directory to which that user has write access, even if that user does not own the file. Of necessity, Samba is subject to the file system semantics of the host operating system. Samba is therefore limited in the file system capabilities that can be made available through Windows ACLs, and therefore performs a "best fit" translation to POSIX ACLs. Some UNIX file systems do, however support, a feature known as extended attributes. Only the Windows concept of inheritance is implemented by Samba through the appropriate extended attribute.
The specific semantics of the extended attributes are not consistent across UNIX and UNIX-like systems such as Linux.
For example, it is possible on some implementations of the extended attributes to set a flag that prevents the directory
or file from being deleted. The extended attribute that may achieve this is called the A file with the i attribute cannot be modified: it cannot be deleted or renamed, no link can be created to this file and no data can be written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can set or clear this attribute. A simple test can be done to check if the immutible flag is supported on files in the file system of the Samba host server. Procedure 16.1. Test for File Immutibility Support
On operating systems and file system types that support the immutible bit, it is possible to create directories that cannot be deleted. Check the man page on your particular host system to determine whether or not immutable directories are writable. If they are not, then the entire directory and its contents will effectively be protected from writing (file creation also) and deletion.
The following parameters in the User- and group-based controls can prove quite useful. In some situations it is distinctly desirable to force all file system operations as if a single user were doing so. The use of the force user and force group behavior will achieve this. In other situations it may be necessary to use a paranoia level of control to ensure that only particular authorized persons will be able to access a share or its contents. Here the use of the valid users or the invalid users parameter may be useful. As always, it is highly advisable to use the easiest to maintain and the least ambiguous method for controlling access. Remember, when you leave the scene, someone else will need to provide assistance, and if he or she finds too great a mess or does not understand what you have done, there is risk of Samba being removed and an alternative solution being adopted. User and Group Based Controls enumerates these controls. Table 16.2. User- and Group-Based Controls Directory permission-based controls, if misused, can result in considerable difficulty in diagnosing the causes of misconfiguration. Use them sparingly and carefully. By gradually introducing each, one at a time, undesirable side effects may be detected. In the event of a problem, always comment all of them out and then gradually reintroduce them in a controlled way. Refer to File and Directory Permission Based Controls for information regarding the parameters that may be used to set file and directory permission-based access controls. Table 16.3. File and Directory Permission-Based Controls
The parameter documented in Other Controls are often used by administrators
in ways that create inadvertent barriers to file access. Such are the consequences of not understanding the
full implications of Table 16.4. Other Controls
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 an effective way to limit who can
connect to a share. In the absence of specific restrictions, the default setting is to allow
the global user At this time Samba does not provide a tool for configuring access control settings on the share itself the only way to create those settings is to use either the NT4 Server Manager or the Windows 200x Microsoft Management Console (MMC) for Computer Management. There are currently no plans to provide this capability in the Samba command-line tool set.
Samba stores the per-share access control settings in a file called The best tool for share permissions management is platform-dependent. Choose the best tool for your environment. The tool you need to manage share permissions on a Samba server from a Windows NT4 Workstation or 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 the Microsoft web site support section. Procedure 16.2. Instructions
On MS Windows NT4/200x/XP system, ACLs on the share itself are set using native tools, usually from File Manager. For example, in Windows 200x, right-click on the shared folder, then select , then click on Permissions. The default Windows NT4/200x permission allows "Everyone" full control on the share. MS Windows 200x and later versions come with a tool called the Computer Management snap-in for the MMC. This tool is located by clicking on . Procedure 16.3. Instructions
Warning
Be careful. If you take away all permissions from the 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. NoteAll 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.
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 Clicking on the button brings up a dialog box telling you who owns the given file. The owner name will be displayed like this:
If the parameter nt acl support is set to The 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 as whom 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. Because clicking on this button causes NT to attempt to change the ownership of a file to the current user logged into the NT client, 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 file system 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 downloadable from the main Samba FTP site. The third button is the button. Clicking on it 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:
If the parameter nt acl support is set to The permissions field is displayed differently for files and directories. Both are discussed next.
The standard UNIX user/group/world triplet and the corresponding
Because many UNIX permission sets do not map into common NT names such as
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
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
The second set of directory permissions has no real meaning in the UNIX permissions world and represents the Samba synthesizes 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 and directory permissions is as simple as changing the displayed permissions in the dialog box and clicking on . 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 also need to be taken into account.
If the parameter nt acl support is set to The first thing to note is that the "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 because these are the only permissions that UNIX actually has. button will not return a list of users in Samba (it will give an error message sayingIf a permission triplet (either user, group, or world) is removed from the list of permissions in the NT dialog box, then when the no permissions on the UNIX side. If you 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. button is pressed, it will be applied as
Because UNIX supports only the “r”, “w”, and “x” bits of an NT ACL, if
other NT security attributes such as 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 .
If you wish to remove all permissions from a user/group/world component, you may either highlight the
component and click on the There are four parameters that control interaction with the standard Samba
When a user clicks on security mask parameter. Any bits that were changed that are not set to 1 in this parameter are left alone in the file permissions. 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 theEssentially, 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
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
For a directory, Samba performs the same operations as
described above for a file except it uses the parameter
The directory security mask parameter
by default is set to the same value as the
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
NoteSamba 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 or herself read access using the security dialog, clicks on to get back to the standard attributes tab dialog, and clicks on 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 to get back to the attributes dialog, you should always press rather than to ensure that your changes are not overridden.Windows administrators are familiar with simple ACL controls, and they typically consider that UNIX user/group/other (ugo) permissions are inadequate and not sufficiently fine-grained. Competing SMB implementations differ in how they handle Windows ACLs. Samba handles Windows ACLs from the perspective of UNIX file system administration and thus adopts the limitations of POSIX ACLs. Therefore, where POSIX ACLs lack a capability of the Windows NT/200X ACLs, the POSIX semantics and limitations are imposed on the Windows administrator. POSIX ACLs present an interesting challenge to the UNIX administrator and therefore force a compromise to be applied to Windows ACLs administration. POSIX ACLs are not covered by an official standard; rather, the latest standard is a draft standard 1003.1e revision 17. This is the POSIX document on which the Samba implementation has been implemented. UNIX vendors differ in the manner in which POSIX ACLs are implemented. There are a number of Linux file systems that support ACLs. Samba has to provide a way to make transparent all the differences between the various implementations of POSIX ACLs. The pressure for ACLs support in Samba has noticeably increased the pressure to standardize ACLs support in the UNIX world. Samba has to deal with the complicated matter of handling the challenge of the Windows ACL that implements inheritance, a concept not anticipated by POSIX ACLs as implemented in UNIX file systems. Samba provides support for masks that permit normal ugo and ACLs functionality to be overrided. This further complicates the way in which Windows ACLs must be implemented. In examining POSIX ACLs we must consider the manner in which they operate for both files and directories. File ACLs have the following significance: # file: testfile <- the file name # owner: jeremy <-- the file owner # group: users <-- the POSIX group owner user::rwx <-- perms for the file owner (user) user:tpot:r-x <-- perms for the additional user `tpot' group::r-- <-- perms for the file group owner (group) group:engrs:r-- <-- perms for the additonal group `engineers' mask:rwx <-- the mask that is `ANDed' with groups other::--- <-- perms applied to everyone else (other) Directory ACLs have the following signficance: # file: testdir <-- the directory name # owner: jeremy <-- the directory owner # group: jeremy <-- the POSIX group owner user::rwx <-- directory perms for owner (user) group::rwx <-- directory perms for owning group (group) mask::rwx <-- the mask that is `ANDed' with group perms other:r-x <-- perms applied to everyone else (other) default:user::rwx <-- inherited owner perms default:user:tpot:rwx <-- inherited extra perms for user `tpot' default:group::r-x <-- inherited group perms default:mask:rwx <-- inherited default mask default:other:--- <-- inherited permissions for everyone (other)
Microsoft Windows NT4/200X ACLs must of necessity be mapped to POSIX ACLs.
The mappings for file permissions are shown in How
Windows File ACLs Map to UNIX POSIX File ACLs.
The # character means this flag is set only when the Windows administrator
sets the Table 16.5. How Windows File ACLs Map to UNIX POSIX File ACLs
As can be seen from the mapping table, there is no one-to-one mapping capability, and therefore Samba must make a logical mapping that will permit Windows to operate more-or-less the way that is intended by the administrator. In general the mapping of UNIX POSIX user/group/other permissions will be mapped to Windows ACLs. This has precedence over the creation of POSIX ACLs. POSIX ACLs are necessary to establish access controls for users and groups other than the user and group that own the file or directory. The UNIX administrator can set any directory permission from within the UNIX environment. The Windows administrator is more restricted in that it is not possible from within Windows Explorer to remove read permission for the file owner. Interesting things happen in the mapping of UNIX POSIX directory permissions and UNIX POSIX ACLs to Windows ACEs (Access Control Entries, the discrete components of an ACL) are mapped to Windows directory ACLs. Directory permissions function in much the same way as shown for file permissions, but there are some notable exceptions and a few peculiarities that the astute administrator will want to take into account in the setting up of directory permissions. File, directory, and share access problems are common topics on the mailing list. The following are examples recently taken from the mailing list.
“
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
root can change the file, no one else can. We need to constantly go to the server to
There are many ways to solve this problem, and here are a few hints:
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. Question: “When user B saves a word document that is owned by user A, the updated file is now owned by user B. Why is Samba doing this? How do I fix this?” Answer: Word does the following when you modify/change a Word document: MS Word creates a new document with a temporary name. Word then closes the old document and deletes it, then renames the new document to the original document name. There is no mechanism by which Samba can in any way know that the new document really should be owned by the owners of the original file. Samba has no way of knowing that the file will be renamed by MS Word. As far as Samba is able to tell, the file that gets created is a new file, not one that the application (Word) is updating.
There is a workaround to solve the permissions problem. It involves understanding how you can manage file
system behavior from within the
These two settings will ensure that all directories and files that get created in the share will be readable/writable by the owner and group set on the directory itself. |
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #16 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0057 ]-- |