Lesson 8 of 9 · 27m
SMB Shares, ACLs, and Windows Semantics Without the Guesswork
Operate Samba shares with explicit authentication, POSIX-to-Windows ACL mapping, opportunistic locking expectations, and audit-ready configuration.
SMB is deceptively familiar because every desktop already knows how to open it. The hard part is that SMB carries Windows semantics: ACLs, opportunistic locks, alternate streams, case behavior, share permissions, and authentication domains. On a Samba server backed by a Unix filesystem, you are operating a translation layer. Translation layers fail at edges.
Start with a tight share definition
A typical /etc/samba/smb.conf fragment:
[global]
security = user
smb encrypt = required
min protocol = SMB3
[teamdata]
path = /srv/teamdata
read only = no
valid users = @teamdata
create mask = 0660
directory mask = 2770
inherit permissions = yes
vfs objects = acl_xattr recycleRun testparm -s before systemctl reload smbd. smb encrypt = required protects data in transit where clients support it. Raising min protocol prevents ancient dialects that weaker clients negotiate accidentally or maliciously.
Share permissions are not filesystem permissions
Samba checks multiple layers:
network access -> authentication -> share definition -> filesystem ownership/mode/ACLA share can permit write while the directory mode denies it. valid users limits who may enter the share; POSIX ownership and ACLs determine what they can do inside. Design both together. Debugging only smb.conf while ignoring ls -l and getfacl wastes hours.
ACLs need a mental bridge
Windows ACLs are richer than traditional Unix modes. Samba can store NT ACLs in extended attributes using acl_xattr, while POSIX ACLs still affect enforcement:
getfacl /srv/teamdata
setfacl -m g:teamdata:rwx /srv/teamdata
namei -l /srv/teamdata/projectUse group ownership and the setgid bit (chgrp teamdata /srv/teamdata && chmod 2770 /srv/teamdata) so new files inherit the group. Mixed Linux/Windows editing can still produce surprising modes. Decide whether applications should preserve permissions, inherit them, or force known masks.
Locking is performance and correctness
SMB clients use opportunistic locking to cache aggressively. This is why a Windows share can feel fast and why multi-protocol access is dangerous. If NFS and SMB clients write the same files without a coherent locking protocol, corruption and stale reads become plausible. Pick one primary write protocol unless the storage platform explicitly supports cross-protocol locking.
Authentication and audit trails
Use domain integration when the organization already has one. For standalone systems, inspect users and sessions with pdbedit -L, smbstatus --shares, smbstatus --locks, and journalctl -u smbd. Enable audit logging for sensitive shares. Knowing that finance-report-final.xlsx was deleted by a workstation session at 14:31 is operational evidence, not surveillance theater.
Field notes
- Case-insensitive Windows clients plus case-sensitive Linux filesystems can create confusing duplicate-looking files.
- macOS SMB clients have their own quirks; test them separately rather than treating all non-Windows clients as identical.
- Recycle VFS objects can save a share from accidental deletion, but recycle retention must be managed like data.
- SMB signing and encryption have CPU costs; measure before applying blanket policy to high-throughput workloads.
- Never expose SMB to the public internet. It is a LAN protocol with decades of attack surface.
Was this lesson helpful?