介绍
在小型网络中,例如家庭网络、或在非域主机中共享目录,通常你不想设置 AD 域或 NT4 域。本文形容了如何配置 Samba 作为独立服务:
- 容许匿名拜访的共享;
- 反对 Samba 本地用户认证的共享;
配置访客拜访的根底 smb.conf
如下配置为,仅容许访客拜访的最小化配置。
[global]
map to guest = Bad User
log file = /var/log/samba/%m
log level = 1
[guest]
# This share allows anonymous (guest) access
# without authentication!
path = /srv/samba/guest/
read only = no
guest ok = yes
guest only = yes
创立认证拜访的根底 smb.conf
如下配置为,Samba 作为 Standlone server 的最小化配置。
[global]
log file = /var/log/samba/%m
log level = 1
[demo]
# This share requires authentication to access
path = /srv/samba/demo/
read only = no
创立本地用户账户
- 在本地零碎创立一个 demoUser 账户:
# useradd -M -s /sbin/nologin demoUser
- 在本地系统启动 demoUser 账户:
# passwd demoUser
Enter new UNIX password: Passw0rd
Retype new UNIX password: Passw0rd
passwd: password updated successfully
- 将 demoUser 账户增加到 Samba 数据库:
# smbpasswd -a demoUser
New SMB password: Passw0rd
Retype new SMB password: Passw0rd
Added user demoUser.
本地用户组治理
创立共享目录
为共享目录设置 ACL
测试共享拜访权限
材料起源
[1] Setting up Samba as a Standalone Server