[Samba] How do I lock a shared file?

steve steve at steve-ss.com
Thu Sep 5 06:08:27 MDT 2013


On Thu, 2013-09-05 at 13:34 +0200, Volker Lendecke wrote:
> 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?
> 
School classes often have projects with files that many students will
need to edit. We are surprised that there is no way for a user to find
out if a file is already open. It causes chaos for us unless we do all
our work in LibreOffice.

Thanks,
Steve




More information about the samba mailing list