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

Rowland Penny rpenny at samba.org
Sat Mar 16 10:51:59 UTC 2024


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?
> 
> Thanks,
> 
> /mjt
> 

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.

Rowland






More information about the samba mailing list