Samba 上的权限错误

Samba 上的权限错误

我有一个带有多个文件夹的 Samba 服务器,但是当用户尝试创建文件夹或文件时,组权限仅设置为“r”(读取),我做错了什么?

我的 Samba 版本是 4.3.11-Ubuntu

这是smb配置文件

[COMPANY]
    browsable = yes
    path = /PATH/OTHERPATH
    guest ok = no
    guest only = no
    create mask = 0770
    force create mode = 0770
    directory mask = 0770
    force directory mode = 0770
    write list = @GROUP1, @GROUP2
    read list =
    valid users = @GROUP1, @GROUP2
    read only = no

这是 Samba 授予我的用户创建的文件和文件夹的权限

-rw-r--r--  1   user    GROUP1      0 jul 12 17:43 file
drwxr-xr-x  2   user    GROUP1   4096 jul 12 17:43 folder/

提前致谢

答案1

正如我在问题下方的评论中所说,要通过 Samba 正确设置权限,您必须将系统 umask 设置为 0007。

我不确定这是否是设置 Samba 的“正确方法”。我注意到,我为 Samba conf 文件中的单个共享授予的权限与在 Samba 共享中创建文件时创建的权限不同。基本上,从系统 umask 来看,Samba 正在删除权限位,实际上它是在其他权限下创建文件。

我很久以前所做的是调整系统 umask。

/etc/配置文件 我补充道

umask 0007

我的 samba conf 文件如下:

#
# Samba config file
#
# To use with umask 0007
[global]
        server string = %h server (Samba, Ubuntu)
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        deadtime = 45
        socket options = TCP_NODELAY IPTOS_THROUGHPUT
        dns proxy = No
        panic action = /usr/share/samba/panic-action %d
        idmap config * : range = 
        idmap config * : backend = tdb
        map acl inherit = Yes
        csc policy = documents
#        interfaces = 10.8.0.0/24 tun0 # do you want to serve your Samba over a dedicated network?
#        hosts allow = 10.8.0.0/24 # these rows are what I'd use in the OpenVPN

[User]
  path = /home/samba/user
  valid users = user
  force group = user
  read only = No
  directory mask = 0770
  force directory mode = 0770
  create mask = 0660
  force create mode = 0660
  write cache size = 2621440
  veto oplock files = /*.tmp/
# in this case, only the user User can r/w his own share.

# What if we have a group with more users?
[Group]
  path = /home/samba/group
  valid users = @group
  force group = group
  read only = No
  directory mask = 0770
  force directory mode = 0770
  create mask = 0660
  force create mode = 0660
  write cache size = 2621440
  veto oplock files = /*.tmp/

如果股票有文件文件,则选择 csc 政策 = 文件 我在 GLOBAL 配置中使用了这个。

可能存在共享文件夹包含可执行文件的情况(主要是在 Windows 系统上,如便携式应用程序)。在这种情况下,您可以使用 csc 政策 = 项目 在共享配置中。

相关内容