Michael Tokarev
2024-Mar-16 05:59 UTC
[Samba] samba allows rename to a locked file (from linux cifs mount)
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
Rowland Penny
2024-Mar-16 10:51 UTC
[Samba] samba allows rename to a locked file (from linux cifs mount)
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
Ralph Boehme
2024-Mar-16 13:06 UTC
[Samba] samba allows rename to a locked file (from linux cifs mount)
On 3/16/24 06:59, Michael Tokarev via samba wrote:> How to prevent rm and mv from touching a locked file?cf man smb.conf "kernel share modes" and git diff d40f57321a12~9..d40f57321a12 Cheers! -slow -------------- next part -------------- A non-text attachment was scrubbed... Name: OpenPGP_signature.asc Type: application/pgp-signature Size: 840 bytes Desc: OpenPGP digital signature URL: <http://lists.samba.org/pipermail/samba/attachments/20240316/1f32f314/OpenPGP_signature.sig>
Maybe Matching Threads
- samba allows rename to a locked file (from linux cifs mount)
- samba allows rename to a locked file (from linux cifs mount)
- samba allows rename to a locked file (from linux cifs mount)
- samba allows rename to a locked file (from linux cifs mount)
- samba allows rename to a locked file (from linux cifs mount)