"net cache flush" needed with samba to restore write permissions - why?

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

homeserver78

New Member
Nov 7, 2023
26
13
3
Sweden
I serve some samba shares from my NAS. The server and all clients are running Linux (Gentoo, Ubuntu, Debian). Now and again a user loses write permissions to a share: the share mounts okay and the files can be read, but when I try to modify a file or create a new one I get a "Permission denied" error. This is solved by simply logging in to the server and running "net cache flush" as root. No need to remount the share or restart/reload the samba server.

I think this only happens on newly mounted shares (e.g. after a client reboot), but I'm not entirely sure. I does not happen after every reboot/remount. I haven't been able to find a clear pattern.

Any idea why this is happening? It's rather annoying...

---

Some background details which may or may not be relevant:

smb.conf contains:
Code:
[global]
passdb backend = tdbsam
server min protocol = SMB3_02

force user = nobody

create mask = 0640
force create mode = 0640
directory mask = 0750
force directory mode = 0750
Most shares are mounted using something like:
Code:
mount -t smb3 <share> <dir> -o rw,username=<samba-user>,uid=<local-user>,forceuid,gid=<local-user>,forcegid,vers=3.1.1,file_mode=0640,dir_mode=0750