linux – Samba不会重新加载用户组成员

我正在运行一个简单的samba服务器设置,其中用户连接到包含特定用户组的文件夹的共享.文件夹是chmod 2770,因此只有位于正确组中的用户才能读/写它们.

问题是,如果我更改组成员身份(即从组中删除用户/将用户添加到组;客户端和服务器之间的更改是同步的!)samba不会自动用户重新加载组成员身份,因此他们仍然可以写入组它们不再是其中的成员.我要么重新连接到共享,要么重新启动samba以应用更改.

有没有办法阻止组缓存和/或在samba中重新加载组成员身份?

我的smb.conf:

[global]
interfaces = ethlan
bind interfaces only = yes
smb ports = 445
workgroup = WORKGROUP
security = user
passdb backend = tdbsam:/var/lib/mysamba/samba.tdb

disable netbios = yes
nt acl support = no
invalid users = root
read only = no
case sensitive = yes
load printers = no
unix extensions = yes

log file = /var/log/samba.log
log level = 1
syslog = 0

use sendfile = yes

[groups]
path = /home/groups
browseable = yes
force create mode = 0770
force directory mode = 2770
hide unreadable = yes

解决方法

您应该只能向它发送信号SIGHUP,而不是重新启动整个Samba服务,以强制它重新加载它的配置文件.

smbd(8) man page

The configuration file,and any files that it includes,are automatically reloaded every minute,if they change. You can force a reload by sending a SIGHUP to the server. Reloading the configuration file will not affect connections to any service that is already established. Either the user will have to disconnect from the service,or smbd killed and restarted.

最后两句很重要:当前连接不受此影响.

您如何处理用户的连接可能会有很大差异,具体取决于具体情况.

>如果他们正在积极使用他们的连接,可能更容易告诉他们重新启动计算机以使更改生效;这样,如果他们处于某事的中间,他们就可以在闲暇时做到这一点.
>对于个人用户,您可以终止他们的连接过程(SIGHUP可能有效,但我目前还不确定);但您可能希望让他们保存和/或关闭他们可能在共享上打开的任何内容,因为他们的连接将被切断.当他们再次访问共享时,他们将使用新访问生成新连接.您可以使用smbstatus查找有关当前连接的信息.>重新启动Samba.这是一种非常激烈的方法,但在某些情况下可能需要.这将终止所有当前连接,强制它们建立新连接.>等一下.如果在特定时间不需要更改,您可以让客户端自行重新建立连接.

相关文章

1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...
如何抑制stable_secret读取关键的“net.ipv6.conf.all.stabl...
1 删除0字节文件 find -type f -size 0 -exec rm -rf {} ...
## 步骤 1:安装必要的软件包 首先,需要确保系统已安装 `dh...