Interaction of share modes and file permissions

Neil Hoggarth neil.hoggarth at
Thu Feb 6 14:26:25 GMT 2003

Consider a file with ownership and mode such that a client has
read-only permission on that file.

Suppose that this file is open read-only by second client, with a
share mode of DENY_WRITE.

If the first client attempts to open the file read-write then a question
arises: what is the appropriate response by the server? There are
multiple reasons why the open should fail ("access denied" and "share
mode violation"), but the response to the Open AndX request only allows
for one reason to be communicated back to the client (I think ...).

I raise this issue because Samba (v2.2.7 on Solaris) appears to respond
to this circumstance differently than a Windows 2000 system does - Samba
reports the share mode problem, whereas Windows reports "access denied".

I stumbled across this distinction when trying to diagnose a problem
with a Windows application called Endnote, which is an academic
reference manager. The application responds differently depending on
which error code it gets - as a result, multiple readers can
simultaneously open an Endnote reference library read-only if it is
stored on Windows share, but only one reader at a time can open the
same file if it is stored on a Samba share.

The fact that the app tries a read-only open on the file if it gets
"permission denied" but doesn't if it encounters a share mode problem
is arguably a misfeature of the app, and Samba's choice about how to
handle the situation seems just as valid as Windows', but I thought
that I'd highlight the difference in case the team think it is worth
"correcting" Samba to make it ape a Windows server more closely.

I have network packet captures which I think illustrate the difference
between Windows and Samba, which I can provide if anyone is interested
in pursuing this?

Neil Hoggarth                                 Departmental Computer Officer
<neil.hoggarth at>                   Laboratory of Physiology                  University of Oxford, UK

More information about the samba-technical mailing list