[Samba] smbd always opens files for writing?

Jamie Tufnell diesql at googlemail.com
Wed Nov 7 19:13:33 GMT 2007


Hi,

I have two Linux machines sharing a directory using Samba.

I am monitoring file changes on the shared directory (server-side)
with inotifywait(1).

When I open a shared file for reading (and reading only) on the
client, the Samba server appears to open it for writing as well.

e.g.

directory on client: /mnt/share
directory on server: /export/share

client$ cat /mnt/share/file.txt >/dev/null
server: inotifywait: /export/share/ (CLOSE_WRITE, CLOSE on file.txt)
# this shouldn't happen? cat(1) opens for reading only
server$ cat /export/share/file.txt >/dev/null
(inotifywait says nothing, as expected)

I have tried mounting with ro and rw with the same results.

I played around a bit more and set:

writable = no
read only = yes

in the smb.conf and things started to work properly, but of course now
I can't write from the client (which I need to do).

I assume I can get around this with two shares (one read-only, one
read/write).. but that will add unnecessary complexity to my
application.

So can I somehow make smbd honor the client's requested file open mode
via configuration setting?  I have read the manual but so far haven't
figured it out.

If anyone can help me out, I'd really appreciate it.

Thanks,
Jamie

PS this is Samba 3.0.24 installed via Debian package.


More information about the samba mailing list