如何阻止在 Samba 共享下的特定目录中写入文本文件?

如何阻止在 Samba 共享下的特定目录中写入文本文件?

我有 samba 共享如下

[g_data]
   path = /g_data2
   browsable = yes
   available = yes
   read only = no
   public = yes
   writable = yes
   guest ok = yes
   create mask = 777
   directory mask = 777
   force create mode = 777
   force directory mode = 777

我想阻止将文本文件写入主共享下的几个子目录。我尝试添加此行

veto files = /*.txt/

但这会阻止所有目录中的文本文件。有没有什么办法可以解决这个问题?任何帮助我都会很感激。谢谢。

这是我的完整 smb.conf

[global]
    dns forwarder = 8.8.8.8
    netbios name = TUB
    realm = UB.LAN
    server role = active directory domain controller
    workgroup = UB

    usershare owner only = false    
    vfs objects = acl_xattr
    map acl inherit = yes
    store dos attributes = yes
    
    winbind enum users = yes
    winbind enum groups = yes

    logon path = \\%L\profiles\%U

[netlogon]
    path = /var/lib/samba/sysvol/ub.lan/scripts
    read only = No

[sysvol]
    path = /var/lib/samba/sysvol
    read only = No
    
[profiles]
    path = /var/lib/samba/profiles
    read only = no
    profile acls = yes

[data]
    path = /data
    browsable = yes
    available = no
    read only = no
    
[r_data]
    path = /r_data
    browsable = yes
    available = yes
    read only = yes
    public = yes
    writable = no
    guest ok = yes

[g_data]
    path = /g_data2
    browsable = yes
    available = yes
    read only = no
    public = yes
    writable = yes
    guest ok = yes
    create mask = 0777
    directory mask = 0777
    force create mode = 0777
    force directory mode = 0777
    force group = nogroup
    veto files = /*.txt/

相关内容