server – When using Samba, how do I stop programs from deleting and recreating a file when I edit it?

I have a Raspberry Pi that I’ve set up as a home file server. It’s running Ubuntu Server 21.04 and Samba Version 4.13.3-Ubuntu.

Here’s the relevant part of my /etc/samba/smb.conf file:

    comment = Samba Share for Us
    path = /media/4TB-NAS/Samba/
    browsable = yes
    read only = no
    valid users = @samba-users
    create mask = 0664
    directory mask = 0775
    force group = samba-users
    vfs objects = recycle
    recycle:repository = /media/4TB-NAS/Samba/.recycle
    recycle:keeptree = yes
    recycle:versions = no
    recycle:touch = yes
    recycle:exclude_dir = .recycle

    comment = MediaShare for Guests
    path = /media/4TB-NAS/Samba/MediaShare/
    guest ok = yes
    browsable = yes
    read only = yes

Here’s the problem: Whenever I connect to my Samba share NAS from my desktop and edit (and save) a TXT file using Pluma or an ODT file using LibreOffice Writer, I think those programs actually delete the old file and then save a new copy of it. How do I stop that from happening? (Or at least hide that behavior from Samba and it’s Recycle Bin feature?)

I noticed this happening because we have two users who use this Samba share. If one user creates a file, they will be that file’s owner. However, if the other user then edits that file, they will actually become the new owner of the file. I’ve actually found this issue documented online: (look for the heading at the bottom titled “MS Word with Samba Changes Owner of File”). This issue (changing file owners) on its own isn’t a big deal for me. With the create mask, directory mask, and force group lines in my smb.conf file, I can work around the changing ownership easily enough.

However, this problem is a bigger pain when it comes to my Samba Recycle Bin. Every time I edit a file, the old version is sent to Samba’s Recycle Bin! I don’t want my Samba Recycle Bin crowded with old versions of files that I did not delete.

How can I solve this problem? Any help or insights would be much appreciated! (= Thank you!