[Samba] samba allows rename to a locked file (from linux cifs mount)

Michael Tokarev mjt at tls.msk.ru
Tue Mar 19 06:05:26 UTC 2024


16.03.2024 13:51, Rowland Penny via samba :
> On Sat, 16 Mar 2024 08:59:10 +0300
> Michael Tokarev via samba <samba at lists.samba.org> wrote:
> 
>> Hi!
>>
>> When I mount a samba share on linux (with mount -t cifs), samba
>> correctly return EBUSY when trying to open a file for writing which
>> is locked by some other client.
>>
>> However, I can trivially rename or (remove and create anew) such file
>> from linux without any restrictions.  After doing so, windows clients
>> fail to open this (replaced) file exactly the same way as if I
>> replaced it behind samba's back (on the server filesystem directly).
>>
>> How to prevent rm and mv from touching a locked file?


> It sounds to me that you are mounting a share on Linux and Samba is
> doing what it should, but if a Linux user changes a file in the share
> directory, then Windows cannot access the file. If this is the case,
> then there is nothing Samba can do to stop this, other than stopping the
> Linux users from logging in locally. Samba has no control over local
> Unix users.

*Sigh*.

When I asked how to change files on the samba server so that windows
can see the changes, I've been told that samba can not see the changes
made on the server, and all changes should be done using samba.  Well,
okay, this is good.

So now, I *am* trying to change these files using the same samba as
all other windows clients are using, mounting this share from samba
on linux and doing file modification there.  Yet I have exactly the
same situation as before: when I'm telling *samba* to rename a file
which is open by some windows client, samba happily does that and
the windows client gets into exactly the same situation as when I
was doing stuff behind samba's back.

C'mon, this is just not right.  Please either read what I wrote, or
don't suggest anything.

/mjt



More information about the samba mailing list