[Samba] How do I lock a shared file?

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Sep 5 05:34:25 MDT 2013


On Thu, Sep 05, 2013 at 01:23:14PM +0200, steve wrote:
> On Thu, 2013-09-05 at 11:51 +0200, Volker Lendecke wrote:
> > On Thu, Sep 05, 2013 at 10:30:56AM +0200, steve wrote:
> > > 4.0.9 as a file server
> > > Hi
> > > We have a rw folder where we can share files. If a user opens a file, I
> > > would like it to be locked so the other users can't open and edit it at
> > > the same time.
> > > 
> > > Is this possible?
> > 
> > Open the file with a smb client with value 0 for the
> > sharing argument. This will block access for other SMB
> > clients.
> > 
> > Volker
> > 
> Hi
> Could you give me pointer as to how to do that? Is it an option in
> smb.conf? Surely, we would want to do this with all files on a network
> no?
> 
> I noticed that LibreOffice does it by producing a lock file. Is there
> anything in Samba that will do that with all files, not just office?

This is a feature of the SMB protocol that a client can
explicitly request. It's called share modes. There is no
option where you can enable this for all open files. This
would not make sense, as very often a single client opens a
file more than once simultaneously.

What is your exact use case for this feature?

With best regards,

Volker Lendecke

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de

*****************************************************************
visit us on it-sa:IT security exhibitions in Nürnberg, Germany
October 8th - 10th 2013, hall 12, booth 333
free tickets available via code 270691 on: www.it-sa.de/gutschein
******************************************************************


More information about the samba mailing list