在具有 SAMBA 共享的 Ubuntu 服务器上,我尝试允许某些 IP 地址的访问并拒绝其他 IP 地址的访问。
我的配置smb.conf
如下:
[global]
server string = %h server (Samba, Ubuntu)
server role = standalone server
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
dns proxy = No
usershare allow guests = Yes
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb
hosts allow = 10.4. 10.162. localhost
hosts deny = 10.4.114.125
[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
[data]
comment = Data Folder
path = /data
force user = devuser
force group = devgroup
group = devgroup
read only = No
create mask = 0660
force create mode = 0664
directory mask = 0774
directory mode = 0774
force directory mode = 0774
guest ok = Yes
然后我通过运行重新加载配置sudo smbcontrol all reload-config
。不幸的是,我无法重新启动 samba 服务,因为其他人正在大量使用它。
重新加载配置后,尽管明确拒绝,我仍然可以从我的计算机 (10.4.114.125) 访问共享。我尝试重新启动计算机,但情况没有改变。有什么想法吗?
编辑:如果我不在全局部分而是在共享部分设置拒绝列表,它似乎可以起作用。
答案1
如果要进行修改,首先需要将所有人从 Samba 服务器上踢出。所有人都下线后,您可以重新启动服务器,这样所有修改都会生效。