1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Chapter�16.�File, Directory, and Share Access Controls</title><link rel="stylesheet" href="../samba.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"><link rel="home" href="index.html" title="The Official Samba 3.4.x HOWTO and Reference Guide"><link rel="up" href="optional.html" title="Part�III.�Advanced Configuration"><link rel="prev" href="rights.html" title="Chapter�15.�User Rights and Privileges"><link rel="next" href="locking.html" title="Chapter�17.�File and Record Locking"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Chapter�16.�File, Directory, and Share Access Controls</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="rights.html">Prev</a>�</td><th width="60%" align="center">Part�III.�Advanced Configuration</th><td width="20%" align="right">�<a accesskey="n" href="locking.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="AccessControls"></a>Chapter�16.�File, Directory, and Share Access Controls</h2></div><div><div class="author"><h3 class="author"><span class="firstname">John</span> <span class="othername">H.</span> <span class="orgname">Samba Team</span> <span class="surname">Terpstra</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jht@samba.org">jht@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jeremy</span> <span class="orgname">Samba Team</span> <span class="surname">Allison</span></h3><div class="affiliation"><span class="orgname">Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jra@samba.org">jra@samba.org</a>></code></p></div></div></div></div><div><div class="author"><h3 class="author"><span class="firstname">Jelmer</span> <span class="othername">R.</span> <span class="orgname">The Samba Team</span> <span class="surname">Vernooij</span></h3><span class="contrib">drawing</span>�<div class="affiliation"><span class="orgname">The Samba Team<br></span><div class="address"><p><code class="email"><<a class="email" href="mailto:jelmer@samba.org">jelmer@samba.org</a>></code></p></div></div></div></div><div><p class="pubdate">May 10, 2003</p></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="AccessControls.html#id2610564">Features and Benefits</a></span></dt><dt><span class="sect1"><a href="AccessControls.html#id2610751">File System Access Controls</a></span></dt><dd><dl><dt><span class="sect2"><a href="AccessControls.html#id2610766">MS Windows NTFS Comparison with UNIX File Systems</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2611102">Managing Directories</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2611225">File and Directory Access Control</a></span></dt></dl></dd><dt><span class="sect1"><a href="AccessControls.html#id2611896">Share Definition Access Controls</a></span></dt><dd><dl><dt><span class="sect2"><a href="AccessControls.html#id2611929">User- and Group-Based Controls</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2612297">File and Directory Permissions-Based Controls</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2612634">Miscellaneous Controls</a></span></dt></dl></dd><dt><span class="sect1"><a href="AccessControls.html#id2612972">Access Controls on Shares</a></span></dt><dd><dl><dt><span class="sect2"><a href="AccessControls.html#id2613120">Share Permissions Management</a></span></dt></dl></dd><dt><span class="sect1"><a href="AccessControls.html#id2613466">MS Windows Access Control Lists and UNIX Interoperability</a></span></dt><dd><dl><dt><span class="sect2"><a href="AccessControls.html#id2613473">Managing UNIX Permissions Using NT Security Dialogs</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2613520">Viewing File Security on a Samba Share</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2613591">Viewing File Ownership</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2613735">Viewing File or Directory Permissions</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2613950">Modifying File or Directory Permissions</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2614107">Interaction with the Standard Samba create mask Parameters</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2614477">Interaction with the Standard Samba File Attribute Mapping</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2614550">Windows NT/200X ACLs and POSIX ACLs Limitations</a></span></dt></dl></dd><dt><span class="sect1"><a href="AccessControls.html#id2614968">Common Errors</a></span></dt><dd><dl><dt><span class="sect2"><a href="AccessControls.html#id2614980">Users Cannot Write to a Public Share</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2615303">File Operations Done as root with force user Set</a></span></dt><dt><span class="sect2"><a href="AccessControls.html#id2615348">MS Word with Samba Changes Owner of File</a></span></dt></dl></dd></dl></div><p>
2
<a class="indexterm" name="id2610395"></a>
3
<a class="indexterm" name="id2610402"></a>
4
<a class="indexterm" name="id2610408"></a>
5
<a class="indexterm" name="id2610415"></a>
6
Advanced MS Windows users are frequently perplexed when file, directory, and share manipulation of
7
resources shared via Samba do not behave in the manner they might expect. MS Windows network
8
administrators are often confused regarding network access controls and how to
9
provide users with the access they need while protecting resources from unauthorized access.
11
<a class="indexterm" name="id2610432"></a>
12
<a class="indexterm" name="id2610439"></a>
13
Many UNIX administrators are unfamiliar with the MS Windows environment and in particular
14
have difficulty in visualizing what the MS Windows user wishes to achieve in attempts to set file
15
and directory access permissions.
17
<a class="indexterm" name="id2610453"></a>
18
<a class="indexterm" name="id2610460"></a>
19
<a class="indexterm" name="id2610467"></a>
20
<a class="indexterm" name="id2610474"></a>
21
The problem lies in the differences in how file and directory permissions and controls work
22
between the two environments. This difference is one that Samba cannot completely hide, even
23
though it does try to bridge the chasm to a degree.
25
<a class="indexterm" name="id2610487"></a>
26
<a class="indexterm" name="id2610494"></a>
27
<a class="indexterm" name="id2610503"></a>
28
<a class="indexterm" name="id2610510"></a>
29
POSIX Access Control List technology has been available (along with extended attributes)
30
for UNIX for many years, yet there is little evidence today of any significant use. This
31
explains to some extent the slow adoption of ACLs into commercial Linux products. MS Windows
32
administrators are astounded at this, given that ACLs were a foundational capability of the now
33
decade-old MS Windows NT operating system.
35
<a class="indexterm" name="id2610527"></a>
36
The purpose of this chapter is to present each of the points of control that are possible with
37
Samba-3 in the hope that this will help the network administrator to find the optimum method
38
for delivering the best environment for MS Windows desktop users.
40
<a class="indexterm" name="id2610542"></a>
41
<a class="indexterm" name="id2610549"></a>
42
This is an opportune point to mention that Samba was created to provide a means of interoperability
43
and interchange of data between differing operating environments. Samba has no intent to change
44
UNIX/Linux into a platform like MS Windows. Instead the purpose was and is to provide a sufficient
45
level of exchange of data between the two environments. What is available today extends well
46
beyond early plans and expectations, yet the gap continues to shrink.
47
</p><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2610564"></a>Features and Benefits</h2></div></div></div><p>
48
Samba offers much flexibility in file system access management. These are the key access control
49
facilities present in Samba today:
50
</p><div class="itemizedlist"><p class="title"><b>Samba Access Control Facilities</b></p><ul type="disc"><li><p>
51
<a class="indexterm" name="id2610585"></a>
52
<span class="emphasis"><em>UNIX File and Directory Permissions</em></span>
54
<a class="indexterm" name="id2610602"></a>
55
<a class="indexterm" name="id2610609"></a>
56
<a class="indexterm" name="id2610616"></a>
57
Samba honors and implements UNIX file system access controls. Users
58
who access a Samba server will do so as a particular MS Windows user.
59
This information is passed to the Samba server as part of the logon or
60
connection setup process. Samba uses this user identity to validate
61
whether or not the user should be given access to file system resources
62
(files and directories). This chapter provides an overview for those
63
to whom the UNIX permissions and controls are a little strange or unknown.
65
<span class="emphasis"><em>Samba Share Definitions</em></span>
67
<a class="indexterm" name="id2610644"></a>
68
In configuring share settings and controls in the <code class="filename">smb.conf</code> file,
69
the network administrator can exercise overrides to native file
70
system permissions and behaviors. This can be handy and convenient
71
to effect behavior that is more like what MS Windows NT users expect,
72
but it is seldom the <span class="emphasis"><em>best</em></span> way to achieve this.
73
The basic options and techniques are described herein.
75
<span class="emphasis"><em>Samba Share ACLs</em></span>
76
<a class="indexterm" name="id2610676"></a>
78
<a class="indexterm" name="id2610688"></a>
79
Just as it is possible in MS Windows NT to set ACLs on shares
80
themselves, so it is possible to do in Samba.
81
Few people make use of this facility, yet it remains one of the
82
easiest ways to affect access controls (restrictions) and can often
83
do so with minimum invasiveness compared with other methods.
85
<a class="indexterm" name="id2610706"></a>
86
<a class="indexterm" name="id2610715"></a>
87
<span class="emphasis"><em>MS Windows ACLs through UNIX POSIX ACLs</em></span>
89
<a class="indexterm" name="id2610731"></a>
90
The use of POSIX ACLs on UNIX/Linux is possible only if the underlying
91
operating system supports them. If not, then this option will not be
92
available to you. Current UNIX technology platforms have native support
93
for POSIX ACLs. There are patches for the Linux kernel that also provide
94
this support. Sadly, few Linux platforms ship today with native ACLs and
95
extended attributes enabled. This chapter has pertinent information
96
for users of platforms that support them.
97
</p></li></ul></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2610751"></a>File System Access Controls</h2></div></div></div><p>
98
Perhaps the most important recognition to be made is the simple fact that MS Windows NT4/200x/XP
99
implement a totally divergent file system technology from what is provided in the UNIX operating system
100
environment. First we consider what the most significant differences are, then we look
101
at how Samba helps to bridge the differences.
102
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2610766"></a>MS Windows NTFS Comparison with UNIX File Systems</h3></div></div></div><p>
103
<a class="indexterm" name="id2610774"></a>
104
<a class="indexterm" name="id2610781"></a>
105
<a class="indexterm" name="id2610788"></a>
106
<a class="indexterm" name="id2610797"></a>
107
Samba operates on top of the UNIX file system. This means it is subject to UNIX file system conventions
108
and permissions. It also means that if the MS Windows networking environment requires file system
109
behavior, that differs from UNIX file system behavior then somehow Samba is responsible for emulating
110
that in a transparent and consistent manner.
112
It is good news that Samba does this to a large extent, and on top of that, provides a high degree
113
of optional configuration to override the default behavior. We look at some of these overrides,
114
but for the greater part we stay within the bounds of default behavior. Those wishing to explore
115
the depths of control ability should review the <code class="filename">smb.conf</code> man page.
116
</p><p>The following compares file system features for UNIX with those of MS Windows NT/200x:
117
<a class="indexterm" name="id2610832"></a>
119
</p><div class="variablelist"><dl><dt><span class="term">Name Space</span></dt><dd><p>
120
MS Windows NT4/200x/XP file names may be up to 254 characters long, and UNIX file names
121
may be 1023 characters long. In MS Windows, file extensions indicate particular file types;
122
in UNIX this is not so rigorously observed because all names are considered arbitrary.
124
What MS Windows calls a folder, UNIX calls a directory.
125
</p></dd><dt><span class="term">Case Sensitivity</span></dt><dd><p>
126
<a class="indexterm" name="id2610877"></a>
127
<a class="indexterm" name="id2610884"></a>
128
MS Windows file names are generally uppercase if made up of 8.3 (8-character file name
129
and 3 character extension. File names that are longer than 8.3 are case preserving and case
132
UNIX file and directory names are case sensitive and case preserving. Samba implements the
133
MS Windows file name behavior, but it does so as a user application. The UNIX file system
134
provides no mechanism to perform case-insensitive file name lookups. MS Windows does this
135
by default. This means that Samba has to carry the processing overhead to provide features
136
that are not native to the UNIX operating system environment.
138
Consider the following. All are unique UNIX names but one single MS Windows file name:
139
</p><pre class="screen">
144
So clearly, in an MS Windows file namespace these three files cannot co-exist, but in UNIX
147
So what should Samba do if all three are present? That which is lexically first will be
148
accessible to MS Windows users; the others are invisible and unaccessible any
149
other solution would be suicidal. The Windows client will ask for a case-insensitive file
150
lookup, and that is the reason for which Samba must offer a consistent selection in the
151
event that the UNIX directory contains multiple files that would match a case insensitive
153
</p></dd><dt><span class="term">Directory Separators</span></dt><dd><p>
154
<a class="indexterm" name="id2610948"></a>
155
MS Windows and DOS use the backslash <code class="constant">\</code> as a directory delimiter, and UNIX uses
156
the forward-slash <code class="constant">/</code> as its directory delimiter. This is handled transparently by Samba.
157
</p></dd><dt><span class="term">Drive Identification</span></dt><dd><p>
158
<a class="indexterm" name="id2610976"></a>
159
MS Windows products support a notion of drive letters, like <code class="literal">C:</code>, to represent
160
disk partitions. UNIX has no concept of separate identifiers for file partitions; each
161
such file system is mounted to become part of the overall directory tree.
162
The UNIX directory tree begins at <code class="constant">/</code> just as the root of a DOS drive is specified as
163
<code class="constant">C:\</code>.
164
</p></dd><dt><span class="term">File Naming Conventions</span></dt><dd><p>
165
<a class="indexterm" name="id2611013"></a>
166
MS Windows generally never experiences file names that begin with a dot (<code class="constant">.</code>), while in UNIX these
167
are commonly found in a user's home directory. Files that begin with a dot (<code class="constant">.</code>) are typically
168
startup files for various UNIX applications, or they may be files that contain
169
startup configuration data.
170
</p></dd><dt><span class="term">Links and Short-Cuts</span></dt><dd><p>
171
<a class="indexterm" name="id2611043"></a>
172
<a class="indexterm" name="id2611052"></a>
173
<a class="indexterm" name="id2611061"></a>
174
MS Windows make use of <span class="emphasis"><em>links and shortcuts</em></span> that are actually special types of files that will
175
redirect an attempt to execute the file to the real location of the file. UNIX knows of file and directory
176
links, but they are entirely different from what MS Windows users are used to.
178
Symbolic links are files in UNIX that contain the actual location of the data (file or directory). An
179
operation (like read or write) will operate directly on the file referenced. Symbolic links are also
180
referred to as “<span class="quote">soft links.</span>” A hard link is something that MS Windows is not familiar with. It allows
181
one physical file to be known simultaneously by more than one file name.
182
</p></dd></dl></div><p>
183
There are many other subtle differences that may cause the MS Windows administrator some temporary discomfort
184
in the process of becoming familiar with UNIX/Linux. These are best left for a text that is dedicated to the
185
purpose of UNIX/Linux training and education.
186
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2611102"></a>Managing Directories</h3></div></div></div><p>
187
<a class="indexterm" name="id2611110"></a>
188
<a class="indexterm" name="id2611117"></a>
189
<a class="indexterm" name="id2611124"></a>
190
There are three basic operations for managing directories: <code class="literal">create</code>, <code class="literal">delete</code>,
191
<code class="literal">rename</code>. <a class="link" href="AccessControls.html#TOSH-Accesstbl" title="Table�16.1.�Managing Directories with UNIX and Windows">Managing Directories with UNIX and
192
Windows</a> compares the commands in Windows and UNIX that implement these operations.
193
</p><div class="table"><a name="TOSH-Accesstbl"></a><p class="title"><b>Table�16.1.�Managing Directories with UNIX and Windows</b></p><div class="table-contents"><table summary="Managing Directories with UNIX and Windows" border="1"><colgroup><col><col><col></colgroup><thead><tr><th align="center">Action</th><th align="center">MS Windows Command</th><th align="center">UNIX Command</th></tr></thead><tbody><tr><td align="center">create</td><td align="center">md folder</td><td align="center">mkdir folder</td></tr><tr><td align="center">delete</td><td align="center">rd folder</td><td align="center">rmdir folder</td></tr><tr><td align="center">rename</td><td align="center">rename oldname newname</td><td align="center">mv oldname newname</td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2611225"></a>File and Directory Access Control</h3></div></div></div><p>
194
<a class="indexterm" name="id2611234"></a>
195
<a class="indexterm" name="id2611243"></a>
196
<a class="indexterm" name="id2611250"></a>
197
The network administrator is strongly advised to read basic UNIX training manuals and reference materials
198
regarding file and directory permissions maintenance. Much can be achieved with the basic UNIX permissions
199
without having to resort to more complex facilities like POSIX ACLs or extended attributes (EAs).
201
UNIX/Linux file and directory access permissions involves setting three primary sets of data and one control set.
202
A UNIX file listing looks as follows:
203
</p><pre class="screen">
204
<code class="prompt">$ </code><strong class="userinput"><code>ls -la</code></strong>
206
drwxr-xr-x 13 maryo gnomes 816 2003-05-12 22:56 .
207
drwxrwxr-x 37 maryo gnomes 3800 2003-05-12 22:29 ..
208
dr-xr-xr-x 2 maryo gnomes 48 2003-05-12 22:29 muchado02
209
drwxrwxrwx 2 maryo gnomes 48 2003-05-12 22:29 muchado03
210
drw-rw-rw- 2 maryo gnomes 48 2003-05-12 22:29 muchado04
211
d-w--w--w- 2 maryo gnomes 48 2003-05-12 22:29 muchado05
212
dr--r--r-- 2 maryo gnomes 48 2003-05-12 22:29 muchado06
213
drwsrwsrwx 2 maryo gnomes 48 2003-05-12 22:29 muchado08
214
---------- 1 maryo gnomes 1242 2003-05-12 22:31 mydata00.lst
215
--w--w--w- 1 maryo gnomes 7754 2003-05-12 22:33 mydata02.lst
216
-r--r--r-- 1 maryo gnomes 21017 2003-05-12 22:32 mydata04.lst
217
-rw-rw-rw- 1 maryo gnomes 41105 2003-05-12 22:32 mydata06.lst
218
<code class="prompt">$ </code>
221
The columns represent (from left to right) permissions, number of hard links to file, owner, group, size
222
(bytes), access date, time of last modification, and file name.
224
An overview of the permissions field is shown in <a class="link" href="AccessControls.html#access1" title="Figure�16.1.�Overview of UNIX permissions field.">Overview of UNIX permissions
226
</p><div class="figure"><a name="access1"></a><p class="title"><b>Figure�16.1.�Overview of UNIX permissions field.</b></p><div class="figure-contents"><div class="mediaobject"><img src="images/access1.png" width="216" alt="Overview of UNIX permissions field."></div></div></div><br class="figure-break"><p>
227
Any bit flag may be unset. An unset bit flag is the equivalent of "cannot" and is represented
228
as a “<span class="quote">-</span>” character (see <a class="link" href="AccessControls.html#access2" title="Example�16.1.�Example File">“Example File”</a>)
229
<a class="indexterm" name="id2611391"></a>
230
<a class="indexterm" name="id2611398"></a>
231
<a class="indexterm" name="id2611405"></a>
232
<a class="indexterm" name="id2611412"></a>
233
<a class="indexterm" name="id2611418"></a>
234
<a class="indexterm" name="id2611425"></a>
235
</p><div class="example"><a name="access2"></a><p class="title"><b>Example�16.1.�Example File</b></p><div class="example-contents"><pre class="programlisting">
237
^^^ The owner (user) can read, write, execute
238
^^^ the group can read and execute
239
^^^ everyone else cannot do anything with it.
240
</pre></div></div><br class="example-break"><p>
241
<a class="indexterm" name="id2611455"></a>
242
<a class="indexterm" name="id2611462"></a>
243
<a class="indexterm" name="id2611468"></a>
244
<a class="indexterm" name="id2611475"></a>
245
Additional possibilities in the [type] field are c = character device, b = block device, p = pipe device,
246
s = UNIX Domain Socket.
248
<a class="indexterm" name="id2611488"></a>
249
<a class="indexterm" name="id2611495"></a>
250
<a class="indexterm" name="id2611501"></a>
251
<a class="indexterm" name="id2611508"></a>
252
<a class="indexterm" name="id2611515"></a>
253
The letters <code class="constant">rwxXst</code> set permissions for the user, group, and others as read (r), write (w),
254
execute (or access for directories) (x), execute only if the file is a directory or already has execute
255
permission for some user (X), set user (SUID) or group ID (SGID) on execution (s), sticky (t).
257
<a class="indexterm" name="id2611534"></a>
258
<a class="indexterm" name="id2611540"></a>
259
<a class="indexterm" name="id2611547"></a>
260
<a class="indexterm" name="id2611554"></a>
261
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.
262
Without the sticky bit, anyone able to write to the directory can delete or rename files. The sticky bit is commonly found on
263
directories, such as <code class="filename">/tmp</code>, that are world-writable.
265
<a class="indexterm" name="id2611580"></a>
266
<a class="indexterm" name="id2611587"></a>
267
<a class="indexterm" name="id2611594"></a>
268
<a class="indexterm" name="id2611601"></a>
269
<a class="indexterm" name="id2611610"></a>
270
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
271
group whose `set user or group' bit is set. This can be helpful in setting up directories for which it is desired that
272
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
273
to be exclusively owned by a user whose primary group is not the group that all such users belong to.
275
When a directory is set <code class="constant">d-wx--x---</code>, the owner can read and create (write) files in it, but because
276
the (r) read flags are not set, files cannot be listed (seen) in the directory by anyone. The group can read files in the
277
directory but cannot create new files. If files in the directory are set to be readable and writable for the group, then
278
group members will be able to write to (or delete) them.
279
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2611642"></a>Protecting Directories and Files from Deletion</h4></div></div></div><p>
280
<a class="indexterm" name="id2611651"></a>
281
<a class="indexterm" name="id2611658"></a>
282
<a class="indexterm" name="id2611664"></a>
283
<a class="indexterm" name="id2611671"></a>
284
People have asked on the Samba mailing list how is it possible to protect files or directories from deletion by users.
285
For example, Windows NT/2K/XP provides the capacity to set access controls on a directory into which people can
286
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
287
but not deleted. Such concepts are foreign to the UNIX operating system file space. Within the UNIX file system
288
anyone who has the ability to create a file can write to it. Anyone who has write permission on the
289
directory that contains a file and has write permission for it has the capability to delete it.
291
<a class="indexterm" name="id2611693"></a>
292
<a class="indexterm" name="id2611700"></a>
293
<a class="indexterm" name="id2611707"></a>
294
For the record, in the UNIX environment the ability to delete a file is controlled by the permissions on
295
the directory that the file is in. In other words, a user can delete a file in a directory to which that
296
user has write access, even if that user does not own the file.
298
<a class="indexterm" name="id2611722"></a>
299
<a class="indexterm" name="id2611729"></a>
300
<a class="indexterm" name="id2611736"></a>
301
<a class="indexterm" name="id2611742"></a>
302
Of necessity, Samba is subject to the file system semantics of the host operating system. Samba is therefore
303
limited in the file system capabilities that can be made available through Windows ACLs, and therefore performs
304
a "best fit" translation to POSIX ACLs. Some UNIX file systems do, however support, a feature known
305
as extended attributes. Only the Windows concept of <span class="emphasis"><em>inheritance</em></span> is implemented by Samba through
306
the appropriate extended attribute.
308
<a class="indexterm" name="id2611764"></a>
309
<a class="indexterm" name="id2611771"></a>
310
<a class="indexterm" name="id2611778"></a>
311
<a class="indexterm" name="id2611785"></a>
312
The specific semantics of the extended attributes are not consistent across UNIX and UNIX-like systems such as Linux.
313
For example, it is possible on some implementations of the extended attributes to set a flag that prevents the directory
314
or file from being deleted. The extended attribute that may achieve this is called the <code class="constant">immutible</code> bit.
315
Unfortunately, the implementation of the immutible flag is NOT consistent with published documentation. For example, the
316
man page for the <code class="literal">chattr</code> on SUSE Linux 9.2 says:
317
</p><pre class="screen">
318
A file with the i attribute cannot be modified: it cannot be deleted
319
or renamed, no link can be created to this file and no data can be
320
written to the file. Only the superuser or a process possessing the
321
CAP_LINUX_IMMUTABLE capability can set or clear this attribute.
323
A simple test can be done to check if the immutible flag is supported on files in the file system of the Samba host
325
</p><div class="procedure"><a name="id2611823"></a><p class="title"><b>Procedure�16.1.�Test for File Immutibility Support</b></p><ol type="1"><li><p>
326
Create a file called <code class="filename">filename</code>.
328
Login as the <code class="constant">root</code> user, then set the immutibile flag on a test file as follows:
329
</p><pre class="screen">
330
<code class="prompt">root# </code> chattr +i `filename'
333
Login as the user who owns the file (not root) and attempt to remove the file as follows:
334
</p><pre class="screen">
335
mystic:/home/hannibal > rm filename
337
It will not be possible to delete the file if the immutible flag is correctly honored.
338
</p></li></ol></div><p>
339
On operating systems and file system types that support the immutible bit, it is possible to create directories
340
that cannot be deleted. Check the man page on your particular host system to determine whether or not
341
immutable directories are writable. If they are not, then the entire directory and its contents will effectively
342
be protected from writing (file creation also) and deletion.
343
</p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2611896"></a>Share Definition Access Controls</h2></div></div></div><p>
344
<a class="indexterm" name="id2611904"></a>
345
The following parameters in the <code class="filename">smb.conf</code> file sections define a share control or affect access controls.
346
Before using any of the following options, please refer to the man page for <code class="filename">smb.conf</code>.
347
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2611929"></a>User- and Group-Based Controls</h3></div></div></div><p>
348
User- and group-based controls can prove quite useful. In some situations it is distinctly desirable to
349
force all file system operations as if a single user were doing so. The use of the
350
<a class="link" href="smb.conf.5.html#FORCEUSER" target="_top">force user</a> and <a class="link" href="smb.conf.5.html#FORCEGROUP" target="_top">force group</a> behavior will achieve this.
351
In other situations it may be necessary to use a paranoia level of control to ensure that only particular
352
authorized persons will be able to access a share or its contents. Here the use of the
353
<a class="link" href="smb.conf.5.html#VALIDUSERS" target="_top">valid users</a> or the <a class="link" href="smb.conf.5.html#INVALIDUSERS" target="_top">invalid users</a> parameter may be useful.
355
As always, it is highly advisable to use the easiest to maintain and the least ambiguous method for
356
controlling access. Remember, when you leave the scene, someone else will need to provide assistance, and
357
if he or she finds too great a mess or does not understand what you have done, there is risk of
358
Samba being removed and an alternative solution being adopted.
360
<a class="link" href="AccessControls.html#ugbc" title="Table�16.2.�User- and Group-Based Controls">User and Group Based Controls</a> enumerates these controls.
361
</p><div class="table"><a name="ugbc"></a><p class="title"><b>Table�16.2.�User- and Group-Based Controls</b></p><div class="table-contents"><table summary="User- and Group-Based Controls" border="1"><colgroup><col align="left"><col align="justify"></colgroup><thead><tr><th align="center">Control Parameter</th><th align="center">Description, Action, Notes</th></tr></thead><tbody><tr><td align="left"><a class="link" href="smb.conf.5.html#ADMINUSERS" target="_top">admin users</a></td><td align="justify"><p>
362
List of users who will be granted administrative privileges on the share.
363
They will do all file operations as the superuser (root).
364
Users in this list will be able to do anything they like on the share,
365
irrespective of file permissions.
366
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#FORCEGROUP" target="_top">force group</a></td><td align="justify"><p>
367
Specifies a UNIX group name that will be assigned as the default primary group
368
for all users connecting to this service.
369
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#FORCEUSER" target="_top">force user</a></td><td align="justify"><p>
370
Specifies a UNIX username that will be assigned as the default user for all users connecting to this service.
371
This is useful for sharing files. Incorrect use can cause security problems.
372
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#GUESTOK" target="_top">guest ok</a></td><td align="justify"><p>
373
If this parameter is set for a service, then no password is required to connect to the service. Privileges will be
374
those of the guest account.
375
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#INVALIDUSERS" target="_top">invalid users</a></td><td align="justify"><p>
376
List of users that should not be allowed to login to this service.
377
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#ONLYUSER" target="_top">only user</a></td><td align="justify"><p>
378
Controls whether connections with usernames not in the user list will be allowed.
379
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#READLIST" target="_top">read list</a></td><td align="justify"><p>
380
List of users that are given read-only access to a service. Users in this list
381
will not be given write access, no matter what the read-only option is set to.
382
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#USERNAME" target="_top">username</a></td><td align="justify"><p>
383
Refer to the <code class="filename">smb.conf</code> man page for more information; this is a complex and potentially misused parameter.
384
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#VALIDUSERS" target="_top">valid users</a></td><td align="justify"><p>
385
List of users that should be allowed to login to this service.
386
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#WRITELIST" target="_top">write list</a></td><td align="justify"><p>
387
List of users that are given read-write access to a service.
388
</p></td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2612297"></a>File and Directory Permissions-Based Controls</h3></div></div></div><p>
389
Directory permission-based controls, if misused, can result in considerable difficulty in diagnosing the causes of
390
misconfiguration. Use them sparingly and carefully. By gradually introducing each, one at a time, undesirable side
391
effects may be detected. In the event of a problem, always comment all of them out and then gradually reintroduce
392
them in a controlled way.
394
Refer to <a class="link" href="AccessControls.html#fdpbc" title="Table�16.3.�File and Directory Permission-Based Controls">File and Directory Permission Based Controls</a> for information
395
regarding the parameters that may be used to set file and directory permission-based access controls.
396
</p><div class="table"><a name="fdpbc"></a><p class="title"><b>Table�16.3.�File and Directory Permission-Based Controls</b></p><div class="table-contents"><table summary="File and Directory Permission-Based Controls" border="1"><colgroup><col align="left"><col align="justify"></colgroup><thead><tr><th align="center">Control Parameter</th><th align="center">Description, Action, Notes</th></tr></thead><tbody><tr><td align="left"><a class="link" href="smb.conf.5.html#CREATEMASK" target="_top">create mask</a></td><td align="justify"><p>
397
Refer to the <code class="filename">smb.conf</code> man page.
398
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#DIRECTORYMASK" target="_top">directory mask</a></td><td align="justify"><p>
399
The octal modes used when converting DOS modes to UNIX modes when creating UNIX directories.
400
See also directory security mask.
401
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#DOSFILEMODE" target="_top">dos filemode</a></td><td align="justify"><p>
402
Enabling this parameter allows a user who has write access to the file to modify the permissions on it.
403
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#FORCECREATEMODE" target="_top">force create mode</a></td><td align="justify"><p>
404
This parameter specifies a set of UNIX-mode bit permissions that will always be set on a file created by Samba.
405
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#FORCEDIRECTORYMODE" target="_top">force directory mode</a></td><td align="justify"><p>
406
This parameter specifies a set of UNIX-mode bit permissions that will always be set on a directory created by Samba.
407
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#FORCEDIRECTORYSECURITYMODE" target="_top">force directory security mode</a></td><td align="justify"><p>
408
Controls UNIX permission bits modified when a Windows NT client is manipulating UNIX permissions on a directory.
409
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#FORCESECURITYMODE" target="_top">force security mode</a></td><td align="justify"><p>
410
Controls UNIX permission bits modified when a Windows NT client manipulates UNIX permissions.
411
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#HIDEUNREADABLE" target="_top">hide unreadable</a></td><td align="justify"><p>
412
Prevents clients from seeing the existence of files that cannot be read.
413
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#HIDEUNWRITEABLEFILES" target="_top">hide unwriteable files</a></td><td align="justify"><p>
414
Prevents clients from seeing the existence of files that cannot be written to. Unwritable directories are shown as usual.
415
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#NTACLSUPPORT" target="_top">nt acl support</a></td><td align="justify"><p>
416
This parameter controls whether smbd will attempt to map UNIX permissions into Windows NT ACLs.
417
</p></td></tr><tr><td align="left"><a class="link" href="smb.conf.5.html#SECURITYMASK" target="_top">security mask</a></td><td align="justify"><p>
418
Controls UNIX permission bits modified when a Windows NT client is manipulating the UNIX permissions on a file.
419
</p></td></tr></tbody></table></div></div><br class="table-break"></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2612634"></a>Miscellaneous Controls</h3></div></div></div><p>
420
The parameters documented in <a class="link" href="AccessControls.html#mcoc" title="Table�16.4.�Other Controls">Other Controls</a> are often used by administrators
421
in ways that create inadvertent barriers to file access. Such are the consequences of not understanding the
422
full implications of <code class="filename">smb.conf</code> file settings.
423
</p><div class="table"><a name="mcoc"></a><p class="title"><b>Table�16.4.�Other Controls</b></p><div class="table-contents"><table summary="Other Controls" border="1"><colgroup><col align="justify"><col align="justify"></colgroup><thead><tr><th align="center">Control Parameter</th><th align="center">Description, Action, Notes</th></tr></thead><tbody><tr><td align="justify">
424
<a class="link" href="smb.conf.5.html#CASESENSITIVE" target="_top">case sensitive</a>,
425
<a class="link" href="smb.conf.5.html#DEFAULTCASE" target="_top">default case</a>,
426
<a class="link" href="smb.conf.5.html#SHORTPRESERVECASE" target="_top">short preserve case</a>
427
</td><td align="justify"><p>
428
This means that all file name lookup will be done in a case-sensitive manner.
429
Files will be created with the precise file name Samba received from the MS Windows client.
430
</p></td></tr><tr><td align="justify"><a class="link" href="smb.conf.5.html#CSCPOLICY" target="_top">csc policy</a></td><td align="justify"><p>
431
Client-side caching policy parallels MS Windows client-side file caching capabilities.
432
</p></td></tr><tr><td align="justify"><a class="link" href="smb.conf.5.html#DONTDESCEND" target="_top">dont descend</a></td><td align="justify"><p>
433
Allows specifying a comma-delimited list of directories that the server should always show as empty.
434
</p></td></tr><tr><td align="justify"><a class="link" href="smb.conf.5.html#DOSFILETIMERESOLUTION" target="_top">dos filetime resolution</a></td><td align="justify"><p>
435
This option is mainly used as a compatibility option for Visual C++ when used against Samba shares.
436
</p></td></tr><tr><td align="justify"><a class="link" href="smb.conf.5.html#DOSFILETIMES" target="_top">dos filetimes</a></td><td align="justify"><p>
437
DOS and Windows allow users to change file timestamps if they can write to the file. POSIX semantics prevent this.
438
This option allows DOS and Windows behavior.
439
</p></td></tr><tr><td align="justify"><a class="link" href="smb.conf.5.html#FAKEOPLOCKS" target="_top">fake oplocks</a></td><td align="justify"><p>
440
Oplocks are the way that SMB clients get permission from a server to locally cache file operations. If a server grants an
441
oplock, the client is free to assume that it is the only one accessing the file, and it will aggressively cache file data.
442
</p></td></tr><tr><td align="justify">
443
<a class="link" href="smb.conf.5.html#HIDEDOTFILES" target="_top">hide dot files</a>,
444
<a class="link" href="smb.conf.5.html#HIDEFILES" target="_top">hide files</a>,
445
<a class="link" href="smb.conf.5.html#VETOFILES" target="_top">veto files</a>
446
</td><td align="justify"><p>
447
Note: MS Windows Explorer allows override of files marked as hidden so they will still be visible.
448
</p></td></tr><tr><td align="justify"><a class="link" href="smb.conf.5.html#READONLY" target="_top">read only</a></td><td align="justify"><p>
449
If this parameter is yes, then users of a service may not create or modify files in the service's directory.
450
</p></td></tr><tr><td align="justify"><a class="link" href="smb.conf.5.html#VETOFILES" target="_top">veto files</a></td><td align="justify"><p>
451
List of files and directories that are neither visible nor accessible.
452
</p></td></tr></tbody></table></div></div><br class="table-break"></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2612972"></a>Access Controls on Shares</h2></div></div></div><p>
453
<a class="indexterm" name="id2612980"></a>
454
<a class="indexterm" name="id2612987"></a>
455
<a class="indexterm" name="id2612994"></a>
456
<a class="indexterm" name="id2613001"></a>
457
<a class="indexterm" name="id2613008"></a>
458
This section deals with how to configure Samba per-share access control restrictions.
459
By default, Samba sets no restrictions on the share itself. Restrictions on the share itself
460
can be set on MS Windows NT4/200x/XP shares. This can be an effective way to limit who can
461
connect to a share. In the absence of specific restrictions, the default setting is to allow
462
the global user <code class="constant">Everyone - Full Control</code> (full control, change and read).
464
<a class="indexterm" name="id2613031"></a>
465
<a class="indexterm" name="id2613038"></a>
466
<a class="indexterm" name="id2613045"></a>
467
At this time Samba does not provide a tool for configuring access control settings on the share
468
itself the only way to create those settings is to use either the NT4 Server Manager or the Windows 200x
469
Microsoft Management Console (MMC) for Computer Management. There are currently no plans to provide
470
this capability in the Samba command-line tool set.
472
<a class="indexterm" name="id2613061"></a>
473
<a class="indexterm" name="id2613068"></a>
474
<a class="indexterm" name="id2613075"></a>
475
<a class="indexterm" name="id2613082"></a>
476
Samba stores the per-share access control settings in a file called <code class="filename">share_info.tdb</code>.
477
The location of this file on your system will depend on how Samba was compiled. The default location
478
for Samba's tdb files is under <code class="filename">/usr/local/samba/var</code>. If the <code class="filename">tdbdump</code>
479
utility has been compiled and installed on your system, then you can examine the contents of this file
480
by executing <code class="literal">tdbdump share_info.tdb</code> in the directory containing the tdb files.
481
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2613120"></a>Share Permissions Management</h3></div></div></div><p>
482
The best tool for share permissions management is platform-dependent. Choose the best tool for your environment.
483
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2613132"></a>Windows NT4 Workstation/Server</h4></div></div></div><p>
484
<a class="indexterm" name="id2613140"></a>
485
<a class="indexterm" name="id2613147"></a>
486
<a class="indexterm" name="id2613154"></a>
487
<a class="indexterm" name="id2613161"></a>
488
The tool you need to manage share permissions on a Samba server from a Windows NT4 Workstation or Server
489
is the NT Server Manager. Server Manager is shipped with Windows NT4 Server products but not with Windows
490
NT4 Workstation. You can obtain the NT Server Manager for MS Windows NT4 Workstation from the Microsoft
491
web site <a class="ulink" href="http://support.microsoft.com/default.aspx?scid=kb;en-us;173673" target="_top">support</a> section.
492
</p><div class="procedure"><a name="id2613181"></a><p class="title"><b>Procedure�16.2.�Instructions</b></p><ol type="1"><li><p>
493
Launch the <span class="application">NT4 Server Manager</span> and click on the Samba server you want to
494
administer. From the menu select <span class="guimenu">Computer</span>, then click on
495
<span class="guimenuitem">Shared Directories</span>.
497
Click on the share that you wish to manage and click the <span class="guilabel">Properties</span> tab, then click
498
the <span class="guilabel">Permissions</span> tab. Now you can add or change access control settings as you wish.
499
</p></li></ol></div></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2613237"></a>Windows 200x/XP</h4></div></div></div><p>
500
<a class="indexterm" name="id2613245"></a>
501
<a class="indexterm" name="id2613252"></a>
502
<a class="indexterm" name="id2613259"></a>
503
<a class="indexterm" name="id2613265"></a>
504
On <span class="application">MS Windows NT4/200x/XP</span> systems, ACLs on the share itself are set using
505
tools like the MS Explorer. For example, in Windows 200x, right-click on the shared folder,
506
then select <span class="guimenuitem">Sharing</span>, then click on <span class="guilabel">Permissions</span>. The default
507
Windows NT4/200x permissions allow the group "Everyone" full control on the share.
509
<a class="indexterm" name="id2613298"></a>
510
<a class="indexterm" name="id2613305"></a>
511
<a class="indexterm" name="id2613312"></a>
512
MS Windows 200x and later versions come with a tool called the <span class="application">Computer Management</span>
513
snap-in for the MMC. This tool can be accessed via <span class="guimenu">Control Panel ->
514
Administrative Tools -> Computer Management</span>.
515
</p><div class="procedure"><a name="id2613336"></a><p class="title"><b>Procedure�16.3.�Instructions</b></p><ol type="1"><li><p>
516
After launching the MMC with the Computer Management snap-in, click the menu item <span class="guimenuitem">Action</span>
517
and select <span class="guilabel">Connect to another computer</span>. If you are not logged onto a domain you will be prompted
518
to enter a domain login user identifier and a password. This will authenticate you to the domain.
519
If you are already logged in with administrative privilege, this step is not offered.
521
If the Samba server is not shown in the <span class="guilabel">Select Computer</span> box, type in the name of the target
522
Samba server in the field <span class="guilabel">Name:</span>. Now click the on <span class="guibutton">[+]</span> next to
523
<span class="guilabel">System Tools</span>, then on the <span class="guibutton">[+]</span> next to
524
<span class="guilabel">Shared Folders</span> in the left panel.
526
<a class="indexterm" name="id2613416"></a>
527
In the right panel, double-click on the share on which you wish to set access control permissions.
528
Then click the tab <span class="guilabel">Share Permissions</span>. It is now possible to add access control entities
529
to the shared folder. Remember to set what type of access (full control, change, read) you
530
wish to assign for each entry.
531
</p></li></ol></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Warning</h3><p>
532
Be careful. If you take away all permissions from the <code class="constant">Everyone</code> user without removing
533
this user, effectively no user will be able to access the share. This is a result of what is known as
534
ACL precedence. Everyone with <span class="emphasis"><em>no access</em></span> means that <code class="constant">MaryK</code> who is
535
part of the group <code class="constant">Everyone</code> will have no access even if she is given explicit full
537
</p></div></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2613466"></a>MS Windows Access Control Lists and UNIX Interoperability</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2613473"></a>Managing UNIX Permissions Using NT Security Dialogs</h3></div></div></div><p>
538
<a class="indexterm" name="id2613481"></a>
539
Windows NT clients can use their native security settings dialog box to view and modify the
540
underlying UNIX permissions.
542
This ability is careful not to compromise the security of the UNIX host on which Samba is running and
543
still obeys all the file permission rules that a Samba administrator can set.
545
Samba does not attempt to go beyond POSIX ACLs, so the various finer-grained access control
546
options provided in Windows are actually ignored.
547
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
548
All access to UNIX/Linux system files via Samba is controlled by the operating system file access controls.
549
When trying to figure out file access problems, it is vitally important to find the identity of the Windows
550
user as it is presented by Samba at the point of file access. This can best be determined from the
552
</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2613520"></a>Viewing File Security on a Samba Share</h3></div></div></div><p>
553
From an NT4/2000/XP client, right-click on any file or directory in a Samba-mounted drive letter
554
or UNC path. When the menu pops up, click on the <span class="guilabel">Properties</span> entry at the bottom
555
of the menu. This brings up the file <code class="constant">Properties</code> dialog box. Click on the
556
<span class="guilabel">Security</span> tab and you will see three buttons: <span class="guibutton">Permissions</span>,
557
<span class="guibutton">Auditing</span>, and <span class="guibutton">Ownership</span>. The <span class="guibutton">Auditing</span>
558
button will cause either an error message <span class="errorname">"A requested privilege is not held by the client"</span>
559
to appear if the user is not the NT administrator, or a dialog intended to allow an administrator
560
to add auditing requirements to a file if the user is logged on as the NT administrator. This dialog is
561
nonfunctional with a Samba share at this time, because the only useful button, the <span class="guibutton">Add</span>
562
button, will not currently allow a list of users to be seen.
563
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2613591"></a>Viewing File Ownership</h3></div></div></div><p>
564
Clicking on the <span class="guibutton">Ownership</span> button brings up a dialog box telling you who owns
565
the given file. The owner name will be displayed like this:
566
</p><pre class="screen">
567
<code class="constant">SERVER\user (Long name)</code>
569
<em class="replaceable"><code>SERVER</code></em> is the NetBIOS name of the Samba server, <em class="replaceable"><code>user</code></em>
570
is the username of the UNIX user who owns the file, and <em class="replaceable"><code>(Long name)</code></em> is the
571
descriptive string identifying the user (normally found in the GECOS field of the UNIX password database).
572
Click on the <span class="guibutton">Close</span> button to remove this dialog.
574
If the parameter <a class="link" href="smb.conf.5.html#NTACLSUPPORT" target="_top">nt acl support</a> is set to <code class="constant">false</code>,
575
the file owner will be shown as the NT user <span class="emphasis"><em>Everyone</em></span>.
577
<a class="indexterm" name="id2613665"></a>
578
The <span class="guibutton">Take Ownership</span> button will not allow you to change the ownership of this file to
579
yourself (clicking it will display a dialog box complaining that the user as whom you are currently logged onto
580
the NT client cannot be found). The reason for this is that changing the ownership of a file is a privileged
581
operation in UNIX, available only to the <span class="emphasis"><em>root</em></span> user. Because clicking on this button causes
582
NT to attempt to change the ownership of a file to the current user logged into the NT client, this will
583
not work with Samba at this time.
585
<a class="indexterm" name="id2613694"></a>
586
<a class="indexterm" name="id2613701"></a>
587
<a class="indexterm" name="id2613708"></a>
588
There is an NT <code class="literal">chown</code> command that will work with Samba and allow a user with administrator
589
privilege connected to a Samba server as root to change the ownership of files on both a local NTFS file system
590
or remote mounted NTFS or Samba drive. This is available as part of the <span class="application">Seclib</span> NT
591
security library written by Jeremy Allison of the Samba Team and is downloadable from the main Samba FTP site.
592
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2613735"></a>Viewing File or Directory Permissions</h3></div></div></div><p>
593
The third button is the <span class="guibutton">Permissions</span> button. Clicking on it brings up a dialog box
594
that shows both the permissions and the UNIX owner of the file or directory. The owner is displayed like this:
595
</p><p><code class="literal"><em class="replaceable"><code>SERVER</code></em>\
596
<em class="replaceable"><code>user</code></em>
597
<em class="replaceable"><code>(Long name)</code></em></code></p><p><em class="replaceable"><code>SERVER</code></em> is the NetBIOS name of the Samba server,
598
<em class="replaceable"><code>user</code></em> is the username of the UNIX user who owns the file, and
599
<em class="replaceable"><code>(Long name)</code></em> is the descriptive string identifying the user (normally found in the
600
GECOS field of the UNIX password database).</p><p>
601
If the parameter <a class="link" href="smb.conf.5.html#NTACLSUPPORT" target="_top">nt acl support</a> is set to <code class="constant">false</code>,
602
the file owner will be shown as the NT user <code class="constant">Everyone</code>, and the permissions will be
603
shown as NT <span class="emphasis"><em>Full Control</em></span>.
605
The permissions field is displayed differently for files and directories. Both are discussed next.
606
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2613818"></a>File Permissions</h4></div></div></div><p>
607
The standard UNIX user/group/world triplet and the corresponding <code class="constant">read, write,
608
execute</code> permissions triplets are mapped by Samba into a three-element NT ACL with the
609
“<span class="quote">r</span>”, “<span class="quote">w</span>”, and “<span class="quote">x</span>” bits mapped into the corresponding NT
610
permissions. The UNIX world permissions are mapped into the global NT group <code class="constant">Everyone</code>, followed
611
by the list of permissions allowed for the UNIX world. The UNIX owner and group permissions are displayed as an NT
612
<span class="guiicon">user</span> icon and an NT <span class="guiicon">local group</span> icon, respectively, followed by the list
613
of permissions allowed for the UNIX user and group.
615
Because many UNIX permission sets do not map into common NT names such as <code class="constant">read</code>,
616
<code class="constant">change</code>, or <code class="constant">full control</code>, usually the permissions will be prefixed
617
by the words <code class="constant">Special Access</code> in the NT display list.
619
But what happens if the file has no permissions allowed for a particular UNIX user group or world component?
620
In order to allow <span class="emphasis"><em>no permissions</em></span> to be seen and modified, Samba then overloads the NT
621
<code class="constant">Take Ownership</code> ACL attribute (which has no meaning in UNIX) and reports a component with
622
no permissions as having the NT <code class="literal">O</code> bit set. This was chosen, of course, to make it look
623
like a zero, meaning zero permissions. More details on the decision behind this action are given below.
624
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2613912"></a>Directory Permissions</h4></div></div></div><p>
625
Directories on an NT NTFS file system have two different sets of permissions. The first set is the ACL set on the
626
directory itself, which is usually displayed in the first set of parentheses in the normal <code class="constant">RW</code>
627
NT style. This first set of permissions is created by Samba in exactly the same way as normal file permissions are, described
628
above, and is displayed in the same way.
630
The second set of directory permissions has no real meaning in the UNIX permissions world and represents the <code class="constant">
631
inherited</code> permissions that any file created within this directory would inherit.
633
Samba synthesizes these inherited permissions for NT by returning as an NT ACL the UNIX permission mode that a new file
634
created by Samba on this share would receive.
635
</p></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2613950"></a>Modifying File or Directory Permissions</h3></div></div></div><p>
636
Modifying file and directory permissions is as simple as changing the displayed permissions in the dialog box
637
and clicking on <span class="guibutton">OK</span>. However, there are limitations that a user needs to be aware of,
638
and also interactions with the standard Samba permission masks and mapping of DOS attributes that also need to
639
be taken into account.
641
If the parameter <a class="link" href="smb.conf.5.html#NTACLSUPPORT" target="_top">nt acl support</a> is set to <code class="constant">false</code>, any attempt to
642
set security permissions will fail with an <span class="errorname">"Access Denied" </span> message.
644
The first thing to note is that the <span class="guibutton">Add</span> button will not return a list of users in Samba
645
(it will give an error message saying <span class="errorname">"The remote procedure call failed and did not
646
execute"</span>). This means that you can only manipulate the current user/group/world permissions listed
647
in the dialog box. This actually works quite well because these are the only permissions that UNIX actually
650
If a permission triplet (either user, group, or world) is removed from the list of permissions in the NT
651
dialog box, then when the <span class="guibutton">OK</span> button is pressed, it will be applied as <span class="emphasis"><em>no
652
permissions</em></span> on the UNIX side. If you view the permissions again, the <span class="emphasis"><em>no
653
permissions</em></span> entry will appear as the NT <code class="literal">O</code> flag, as described above. This allows
654
you to add permissions back to a file or directory once you have removed them from a triplet component.
656
Because UNIX supports only the “<span class="quote">r</span>”, “<span class="quote">w</span>”, and “<span class="quote">x</span>” bits of an NT ACL, if
657
other NT security attributes such as <code class="constant">Delete Access</code> are selected, they will be ignored
658
when applied on the Samba server.
660
When setting permissions on a directory, the second set of permissions (in the second set of parentheses) is
661
by default applied to all files within that directory. If this is not what you want, you must uncheck the
662
<span class="guilabel">Replace permissions on existing files</span> checkbox in the NT dialog before clicking on
663
<span class="guibutton">OK</span>.
665
If you wish to remove all permissions from a user/group/world component, you may either highlight the
666
component and click on the <span class="guibutton">Remove</span> button or set the component to only have the special
667
<code class="constant">Take Ownership</code> permission (displayed as <code class="literal">O</code>) highlighted.
668
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2614107"></a>Interaction with the Standard Samba “<span class="quote">create mask</span>” Parameters</h3></div></div></div><p>There are four parameters that control interaction with the standard Samba <em class="parameter"><code>create mask</code></em> parameters:
671
</p><div class="itemizedlist"><ul type="disc"><li><p><a class="link" href="smb.conf.5.html#SECURITYMASK" target="_top">security mask</a></p></li><li><p><a class="link" href="smb.conf.5.html#FORCESECURITYMODE" target="_top">force security mode</a></p></li><li><p><a class="link" href="smb.conf.5.html#DIRECTORYSECURITYMASK" target="_top">directory security mask</a></p></li><li><p><a class="link" href="smb.conf.5.html#FORCEDIRECTORYSECURITYMODE" target="_top">force directory security mode</a></p></li></ul></div><p>
674
When a user clicks on <span class="guibutton">OK</span> to apply the
675
permissions, Samba maps the given permissions into a user/group/world
676
r/w/x triplet set, and then checks the changed permissions for a
677
file against the bits set in the
678
<a class="link" href="smb.conf.5.html#SECURITYMASK" target="_top">security mask</a> parameter. Any bits that
679
were changed that are not set to <span class="emphasis"><em>1</em></span> in this parameter are left alone
680
in the file permissions.</p><p>
681
Essentially, zero bits in the <a class="link" href="smb.conf.5.html#SECURITYMASK" target="_top">security mask</a>
682
may be treated as a set of bits the user is <span class="emphasis"><em>not</em></span>
683
allowed to change, and one bits are those the user is allowed to change.
685
If not explicitly set, this parameter defaults to the same value as
686
the <a class="link" href="smb.conf.5.html#CREATEMASK" target="_top">create mask</a> parameter. To allow a user to modify all the
687
user/group/world permissions on a file, set this parameter to 0777.
689
Next Samba checks the changed permissions for a file against the bits set in the
690
<a class="link" href="smb.conf.5.html#FORCESECURITYMODE" target="_top">force security mode</a> parameter. Any bits
691
that were changed that correspond to bits set to <span class="emphasis"><em>1</em></span> in this parameter
692
are forced to be set.</p><p>
693
Essentially, bits set in the <em class="parameter"><code>force security mode</code></em> parameter
694
may be treated as a set of bits that, when modifying security on a file, the user
695
has always set to be <span class="emphasis"><em>on</em></span>.</p><p>
696
If not explicitly set, this parameter defaults to the same value
697
as the <a class="link" href="smb.conf.5.html#FORCECREATEMODE" target="_top">force create mode</a> parameter.
698
To allow a user to modify all the user/group/world permissions on a file
699
with no restrictions, set this parameter to 000. The
700
<a class="link" href="smb.conf.5.html#SECURITYMASK" target="_top">security mask</a> and <em class="parameter"><code>force
701
security mode</code></em> parameters are applied to the change
702
request in that order.</p><p>
703
For a directory, Samba performs the same operations as
704
described above for a file except it uses the parameter <em class="parameter"><code>
705
directory security mask</code></em> instead of <em class="parameter"><code>security
706
mask</code></em>, and <em class="parameter"><code>force directory security mode
707
</code></em> parameter instead of <em class="parameter"><code>force security mode
709
The <a class="link" href="smb.conf.5.html#DIRECTORYSECURITYMASK" target="_top">directory security mask</a> parameter
710
by default is set to the same value as the <em class="parameter"><code>directory mask
711
</code></em> parameter and the <em class="parameter"><code>force directory security
712
mode</code></em> parameter by default is set to the same value as
713
the <a class="link" href="smb.conf.5.html#FORCEDIRECTORYMODE" target="_top">force directory mode</a> parameter.
714
In this way Samba enforces the permission restrictions that
715
an administrator can set on a Samba share, while still allowing users
716
to modify the permission bits within that restriction.</p><p>
717
If you want to set up a share that allows users full control
718
in modifying the permission bits on their files and directories and
719
does not force any particular bits to be set <span class="emphasis"><em>on</em></span>,
720
then set the following parameters in the <code class="filename">smb.conf</code> file in that
721
share-specific section:
722
</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2614428"></a><em class="parameter"><code>security mask = 0777</code></em></td></tr><tr><td><a class="indexterm" name="id2614439"></a><em class="parameter"><code>force security mode = 0</code></em></td></tr><tr><td><a class="indexterm" name="id2614451"></a><em class="parameter"><code>directory security mask = 0777</code></em></td></tr><tr><td><a class="indexterm" name="id2614463"></a><em class="parameter"><code>force directory security mode = 0</code></em></td></tr></table></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2614477"></a>Interaction with the Standard Samba File Attribute Mapping</h3></div></div></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
723
Samba maps some of the DOS attribute bits (such as “<span class="quote">read-only</span>”)
724
into the UNIX permissions of a file. This means there can
725
be a conflict between the permission bits set via the security
726
dialog and the permission bits set by the file attribute mapping.
728
If a file has no UNIX read access for the owner, it will show up
729
as “<span class="quote">read-only</span>” in the standard file attributes tabbed dialog.
730
Unfortunately, this dialog is the same one that contains the security information
733
What this can mean is that if the owner changes the permissions
734
to allow himself or herself read access using the security dialog, clicks on
735
<span class="guibutton">OK</span> to get back to the standard attributes tab
736
dialog, and clicks on <span class="guibutton">OK</span> on that dialog, then
737
NT will set the file permissions back to read-only (as that is what
738
the attributes still say in the dialog). This means that after setting
739
permissions and clicking on <span class="guibutton">OK</span> to get back to the
740
attributes dialog, you should always press <span class="guibutton">Cancel</span>
741
rather than <span class="guibutton">OK</span> to ensure that your changes
743
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2614550"></a>Windows NT/200X ACLs and POSIX ACLs Limitations</h3></div></div></div><p>
744
Windows administrators are familiar with simple ACL controls, and they typically
745
consider that UNIX user/group/other (ugo) permissions are inadequate and not
746
sufficiently fine-grained.
748
Competing SMB implementations differ in how they handle Windows ACLs. Samba handles
749
Windows ACLs from the perspective of UNIX file system administration and thus adopts
750
the limitations of POSIX ACLs. Therefore, where POSIX ACLs lack a capability of the
751
Windows NT/200X ACLs, the POSIX semantics and limitations are imposed on the Windows
754
POSIX ACLs present an interesting challenge to the UNIX administrator and therefore
755
force a compromise to be applied to Windows ACLs administration. POSIX ACLs are not
756
covered by an official standard; rather, the latest standard is a draft standard
757
1003.1e revision 17. This is the POSIX document on which the Samba implementation has
760
UNIX vendors differ in the manner in which POSIX ACLs are implemented. There are a
761
number of Linux file systems that support ACLs. Samba has to provide a way to make
762
transparent all the differences between the various implementations of POSIX ACLs.
763
The pressure for ACLs support in Samba has noticeably increased the pressure to
764
standardize ACLs support in the UNIX world.
766
Samba has to deal with the complicated matter of handling the challenge of the Windows
767
ACL that implements <span class="emphasis"><em>inheritance</em></span>, a concept not anticipated by POSIX
768
ACLs as implemented in UNIX file systems. Samba provides support for <span class="emphasis"><em>masks</em></span>
769
that permit normal ugo and ACLs functionality to be overrided. This further complicates
770
the way in which Windows ACLs must be implemented.
771
</p><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2614613"></a>UNIX POSIX ACL Overview</h4></div></div></div><p>
772
In examining POSIX ACLs we must consider the manner in which they operate for
773
both files and directories. File ACLs have the following significance:
774
</p><pre class="screen">
775
# file: testfile <- the file name
776
# owner: jeremy <-- the file owner
777
# group: users <-- the POSIX group owner
778
user::rwx <-- perms for the file owner (user)
779
user:tpot:r-x <-- perms for the additional user `tpot'
780
group::r-- <-- perms for the file group owner (group)
781
group:engrs:r-- <-- perms for the additonal group `engineers'
782
mask:rwx <-- the mask that is `ANDed' with groups
783
other::--- <-- perms applied to everyone else (other)
785
Directory ACLs have the following signficance:
786
</p><pre class="screen">
787
# file: testdir <-- the directory name
788
# owner: jeremy <-- the directory owner
789
# group: jeremy <-- the POSIX group owner
790
user::rwx <-- directory perms for owner (user)
791
group::rwx <-- directory perms for owning group (group)
792
mask::rwx <-- the mask that is `ANDed' with group perms
793
other:r-x <-- perms applied to everyone else (other)
794
default:user::rwx <-- inherited owner perms
795
default:user:tpot:rwx <-- inherited extra perms for user `tpot'
796
default:group::r-x <-- inherited group perms
797
default:mask:rwx <-- inherited default mask
798
default:other:--- <-- inherited permissions for everyone (other)
800
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2614675"></a>Mapping of Windows File ACLs to UNIX POSIX ACLs</h4></div></div></div><p>
801
Microsoft Windows NT4/200X ACLs must of necessity be mapped to POSIX ACLs.
802
The mappings for file permissions are shown in <a class="link" href="AccessControls.html#fdsacls" title="Table�16.5.�How Windows File ACLs Map to UNIX POSIX File ACLs">How
803
Windows File ACLs Map to UNIX POSIX File ACLs</a>.
804
The # character means this flag is set only when the Windows administrator
805
sets the <code class="constant">Full Control</code> flag on the file.
806
</p><div class="table"><a name="fdsacls"></a><p class="title"><b>Table�16.5.�How Windows File ACLs Map to UNIX POSIX File ACLs</b></p><div class="table-contents"><table summary="How Windows File ACLs Map to UNIX POSIX File ACLs" border="1"><colgroup><col align="left"><col align="center"></colgroup><thead><tr><th align="left">Windows ACE</th><th align="center">File Attribute Flag</th></tr></thead><tbody><tr><td align="left"><p>Full Control</p></td><td align="center"><p>#</p></td></tr><tr><td align="left"><p>Traverse Folder/Execute File</p></td><td align="center"><p>x</p></td></tr><tr><td align="left"><p>List Folder/Read Data</p></td><td align="center"><p>r</p></td></tr><tr><td align="left"><p>Read Attributes</p></td><td align="center"><p>r</p></td></tr><tr><td align="left"><p>Read Extended Attribures</p></td><td align="center"><p>r</p></td></tr><tr><td align="left"><p>Create Files/Write Data</p></td><td align="center"><p>w</p></td></tr><tr><td align="left"><p>Create Folders/Append Data</p></td><td align="center"><p>w</p></td></tr><tr><td align="left"><p>Write Attributes</p></td><td align="center"><p>w</p></td></tr><tr><td align="left"><p>Write Extended Attributes</p></td><td align="center"><p>w</p></td></tr><tr><td align="left"><p>Delete Subfolders and Files</p></td><td align="center"><p>w</p></td></tr><tr><td align="left"><p>Delete</p></td><td align="center"><p>#</p></td></tr><tr><td align="left"><p>Read Permissions</p></td><td align="center"><p>all</p></td></tr><tr><td align="left"><p>Change Permissions</p></td><td align="center"><p>#</p></td></tr><tr><td align="left"><p>Take Ownership</p></td><td align="center"><p>#</p></td></tr></tbody></table></div></div><br class="table-break"><p>
807
As can be seen from the mapping table, there is no one-to-one mapping capability, and therefore
808
Samba must make a logical mapping that will permit Windows to operate more-or-less the way
809
that is intended by the administrator.
811
In general the mapping of UNIX POSIX user/group/other permissions will be mapped to
812
Windows ACLs. This has precedence over the creation of POSIX ACLs. POSIX ACLs are necessary
813
to establish access controls for users and groups other than the user and group that
814
own the file or directory.
816
The UNIX administrator can set any directory permission from within the UNIX environment.
817
The Windows administrator is more restricted in that it is not possible from within
818
Windows Explorer to remove read permission for the file owner.
819
</p></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="id2614944"></a>Mapping of Windows Directory ACLs to UNIX POSIX ACLs</h4></div></div></div><p>
820
Interesting things happen in the mapping of UNIX POSIX directory permissions and
821
UNIX POSIX ACLs to Windows ACEs (Access Control Entries, the discrete components of
822
an ACL) are mapped to Windows directory ACLs.
824
Directory permissions function in much the same way as shown for file permissions, but
825
there are some notable exceptions and a few peculiarities that the astute administrator
826
will want to take into account in the setting up of directory permissions.
827
</p></div></div></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2614968"></a>Common Errors</h2></div></div></div><p>
828
File, directory, and share access problems are common topics on the mailing list. The following
829
are examples recently taken from the mailing list.
830
</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2614980"></a>Users Cannot Write to a Public Share</h3></div></div></div><p>
831
The following complaint has frequently been voiced on the Samba mailing list:
832
“<span class="quote">
833
We are facing some troubles with file/directory permissions. I can log on the domain as admin user (root),
834
and there's a public share on which everyone needs to have permission to create/modify files, but only
835
root can change the file, no one else can. We need to constantly go to the server to
836
<strong class="userinput"><code>chgrp -R users *</code></strong> and <strong class="userinput"><code>chown -R nobody *</code></strong> to allow
837
other users to change the file.
840
Here is one way the problem can be solved:
841
</p><div class="procedure"><ol type="1"><li><p>
842
Go to the top of the directory that is shared.
844
Set the ownership to whatever public user and group you want
845
</p><pre class="screen">
846
<code class="prompt">$ </code>find `directory_name' -type d -exec chown user:group {}\;
847
<code class="prompt">$ </code>find `directory_name' -type d -exec chmod 2775 {}\;
848
<code class="prompt">$ </code>find `directory_name' -type f -exec chmod 0775 {}\;
849
<code class="prompt">$ </code>find `directory_name' -type f -exec chown user:group {}\;
851
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>
852
The above will set the <code class="constant">SGID bit</code> on all directories. Read your
853
UNIX/Linux man page on what that does. This ensures that all files and directories
854
that are created in the directory tree will be owned by the current user and will
855
be owned by the group that owns the directory in which it is created.
856
</p></div></li><li><p>
857
Directory is <em class="replaceable"><code>/foodbar</code></em>:
858
</p><pre class="screen">
859
<code class="prompt">$ </code><strong class="userinput"><code>chown jack:engr /foodbar</code></strong>
861
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This is the same as doing:</p><pre class="screen">
862
<code class="prompt">$ </code><strong class="userinput"><code>chown jack /foodbar</code></strong>
863
<code class="prompt">$ </code><strong class="userinput"><code>chgrp engr /foodbar</code></strong>
864
</pre></div></li><li><p>Now type:
866
</p><pre class="screen">
867
<code class="prompt">$ </code><strong class="userinput"><code>chmod 2775 /foodbar</code></strong>
868
<code class="prompt">$ </code><strong class="userinput"><code>ls -al /foodbar/..</code></strong>
870
</p><p>You should see:
871
</p><pre class="screen">
872
drwxrwsr-x 2 jack engr 48 2003-02-04 09:55 foodbar
874
</p></li><li><p>Now type:
875
</p><pre class="screen">
876
<code class="prompt">$ </code><strong class="userinput"><code>su - jill</code></strong>
877
<code class="prompt">$ </code><strong class="userinput"><code>cd /foodbar</code></strong>
878
<code class="prompt">$ </code><strong class="userinput"><code>touch Afile</code></strong>
879
<code class="prompt">$ </code><strong class="userinput"><code>ls -al</code></strong>
882
You should see that the file <code class="filename">Afile</code> created by Jill will have ownership
883
and permissions of Jack, as follows:
884
</p><pre class="screen">
885
-rw-r--r-- 1 jill engr 0 2007-01-18 19:41 Afile
888
If the user that must have write permission in the directory is not a member of the group
889
<span class="emphasis"><em>engr</em></span> set in the <code class="filename">smb.conf</code> entry for the share:
890
</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2615287"></a><em class="parameter"><code>force group = engr</code></em></td></tr></table><p>
891
</p></li></ol></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2615303"></a>File Operations Done as <span class="emphasis"><em>root</em></span> with <span class="emphasis"><em>force user</em></span> Set</h3></div></div></div><p>
892
When you have a user in <a class="link" href="smb.conf.5.html#ADMINUSERS" target="_top">admin users</a>, Samba will always do file operations for
893
this user as <span class="emphasis"><em>root</em></span>, even if <a class="link" href="smb.conf.5.html#FORCEUSER" target="_top">force user</a> has been set.
894
</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="id2615348"></a>MS Word with Samba Changes Owner of File</h3></div></div></div><p>
895
<span class="emphasis"><em>Question:</em></span> “<span class="quote">When user B saves a word document that is owned by user A,
896
the updated file is now owned by user B. Why is Samba doing this? How do I fix this?</span>”
898
<span class="emphasis"><em>Answer:</em></span> Word does the following when you modify/change a Word document: MS Word creates a new document with
899
a temporary name. Word then closes the old document and deletes it, then renames the new document to the original document name.
900
There is no mechanism by which Samba can in any way know that the new document really should be owned by the owners
901
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
902
to tell, the file that gets created is a new file, not one that the application (Word) is updating.
904
There is a workaround to solve the permissions problem. It involves understanding how you can manage file
905
system behavior from within the <code class="filename">smb.conf</code> file, as well as understanding how UNIX file systems work. Set on the directory
906
in which you are changing Word documents: <code class="literal">chmod g+s `directory_name'.</code> This ensures that all files will
907
be created with the group that owns the directory. In <code class="filename">smb.conf</code> share declaration section set:
909
</p><table class="simplelist" border="0" summary="Simple list"><tr><td><a class="indexterm" name="id2615427"></a><em class="parameter"><code>force create mode = 0660</code></em></td></tr><tr><td><a class="indexterm" name="id2615439"></a><em class="parameter"><code>force directory mode = 0770</code></em></td></tr></table><p>
911
These two settings will ensure that all directories and files that get created in the share will be readable/writable by the
912
owner and group set on the directory itself.
913
</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="rights.html">Prev</a>�</td><td width="20%" align="center"><a accesskey="u" href="optional.html">Up</a></td><td width="40%" align="right">�<a accesskey="n" href="locking.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter�15.�User Rights and Privileges�</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">�Chapter�17.�File and Record Locking</td></tr></table></div></body></html>