samba服务器主配置文件smb.conf详解(超详细,实测有效 )

SMB

SMB(Server Message Block,信息服务块)是用于在局域网共享文件和打印机的一种通信协议。

Samba

Samba则是实现SMB协议的软件。

安装Samba

Ubuntu环境

sudo apt-get update(更新apt-get)
sudo apt-get install samba(安装samba)

主配置文件smb.conf

路径位于/etc/samba/目录下
sudo vim /etc/samba/smb.conf(编辑smb.conf文件)
smb.conf配置如下:

#全局设置

[global]
#workgroup/NT-domain,工作组/NT域名)
workgroup = WORKGROUP
#描述
server string = %h server (Samba,Ubuntu)
#禁止nmbd通过DNS搜索NetBIOS名称
dns proxy = no

#网络设置

#这块我还没弄明白,后面再补上

#Debug

#log.smbd和log.nmbd日志路径
log file = /var/log/samba/log.%m
#日志容量(单位为KB)
max log size = 1000
#通过syslog写日志(若设置则日志谢总syslog,而非log.smbd和log.nmbd)
#syslog only = yes
#若使用syslog则设置更高一点,如syslog = 1000
syslog = 0
#回溯,panic-action是一个脚本,有兴趣的打开看看
panic action = /usr/share/samba/panic-action %d

#验证

#服务器模式(数种不同的模式)
server role = standalone server
#加密密码类型
passdb bakend = tdbsam
obey pam restrictions = yes
#同步unix密码
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = Enter\snew\s\spassword:* %n\n Retype\snew\s\spassword:* %n\n password\supdated\ssuccessfully .
pam password change = yes
#连接失败
map to guest = bad user

#Domain

#若使用primary classic domain controller,backup domain controller,
domain logons则需要配置

#Misc

usershare allow guests = yes

#Share Definitions

#默认的打印机服务,不用可以注释掉
[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
guest ok = no
read only = yes
create mask = 0700
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = no
#共享配置
[samba]
#描述
comment = share folder
#浏览权限
browseable = yes
#共享文件夹
path = /home/lky/samba
#权限
create mask=0777
directory mask=0777
force user=lky
force group=lky
public=yes
writeable=yes
available=yes

你可能感兴趣的:(Linux,服务器,linux,ubuntu,centos,服务器,samba)