freebsd12安装samba4

pkg search samba
pkg install -y samba411-4.11.8

smbd -b | grep CONFIGFILE
/usr/local/etc/smb4.conf

vim /etc/rc.conf
samba_server_enable="YES"
Set samba_server_enable to YES in /etc/rc.conf

service samba_server onestart

cd /usr/local/etc/
vim smb4.conf
[global]
workgroup = WORKGROUP
server string = Samba Server Version %v
netbios name = ExampleMachine
wins support = Yes
security = user
passdb backend = tdbsam

Example: share /usr/src accessible only to 'developer' user

[opt]
path = /opt/home/yang
valid users = bsdusr
writable = yes
browsable = yes
read only = no
guest ok = no
public = no
create mask = 0666
directory mask = 0755

tdbsam: 创建数据库文件并使用pdbedit建立SMB独立用户,
smbpasswd -a bsdusr
建立samba用户并设置密码,不过需要先建立系统用户,也可以使用pdbedit命令来建立samba用户
pdbedit -a bsdusr
:新建samba账号
pdbedit -x username:删除samba账号
pdbedit -L
:列出samba账号列表,读取passdb.tdb数据库文件

pw useradd bsdusr -s /bin/csh -d /home/bsder -m -g wheel -h 0
pw useradd bsdusr -s /sbin/nologin -d /opt/bsdusr -h 0

adduser
smbpasswd -a bsdusr

pw useradd/usershow/usermod
[-n name] 指定用户名
[-d dir] 指定用户家目录
[-m] 自动创建用户家目录
pw [-V etcdir] useradd [name|uid] [-C config] [-q] [-n name] [-u uid] [-c comment]
[-d dir] [-e date] [-p date] [-g group] [-G grouplist] [-m] [-k dir]
[-w method] [-s shell] [-o] [-L class] [-h fd | -H fd] [-N] [-P] [-Y]

pw [-V etcdir] usermod [name|uid] [-C config] [-q] [-n name] [-u uid] [-c comment]
[-d dir] [-e date] [-p date] [-g group] [-G grouplist] [-l name] [-m] [-k dir]
[-w method] [-s shell] [-L class] [-h fd | -H fd] [-N] [-P] [-Y]
参考
https://blog.andreev.it/?p=2676

你可能感兴趣的:(freebsd12安装samba4)