[Samba] How do I lock a shared file?
steve at steve-ss.com
Thu Sep 5 06:23:10 MDT 2013
On Thu, 2013-09-05 at 14:14 +0200, Volker Lendecke wrote:
> On Thu, Sep 05, 2013 at 02:08:27PM +0200, steve wrote:
> > > 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.
> Your clients are Linux?
A mix of Linux, xp and 7.
> Well, indeed there is no good
> support for locking files across applications. If your
> clients are Windows then that should work fine, Windows
> traditionally was better at that.
No, it doesn't seem to work for us. Anyone can open e.g. a txt file with
notepad or anything else, simultaneously. Between any combination of
> Linux programs like vim do it on their own, like many
> editors do. But many programs don't do that well. That's why
> version control systems like git and all the other ones
> exist. Certainly overkill for 6-year-olds, but it allows
> more parallel work.
> Also, nobody forces applications to keep files open while
> they are edited. For example even some Windows native editor
> (I don't remember which) loads files into memory and closes
> the file until saving.
It's a pity that we'll have to work around it. Surely Samba knows if a
file is open or not doesn't it? What's all this oplock stuff? It would
be useful if we could have an option for smb.conf like:
lock open files = Yes
I realise that it's not for everybody. Would that be hard to implement?
More information about the samba