前几天,公司限来回传文件麻烦,也是想保留一些共享文件。所以就弄了个samba。
配置参数
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.
[global]
workgroup = SAMBA
security = user
##### add by Jin Peng ###
guest ok = yes
browseable = yes
map to guest = bad user
guest account = nobody
####################
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
[homes]
comment = Home Directories
valid users = %S, %D%w%S
browseable = No
read only = No
inherit acls = Yes
# [printers]
# comment = All Printers
# path = /var/tmp
# printable = Yes
# create mask = 0600
# browseable = No
#
# [print$]
# comment = Printer Drivers
# path = /var/lib/samba/drivers
# write list = root
# create mask = 0664
# directory mask = 0775
[xiaozhao]
comment = files of xiaozhao # comment是对该共享的描述,可以是任意字符串。
path = /data/samba_files/xiaozhao #共享文件的路径,文件域
public = yes
# guest ok = yes
# 如果 guest ok = no 其他人就不能访问了。
guest ok = no
browseable = yes #如果设置为NO 访问的时候看都看不见
writable = yes
write list = xiaozhao (多个用户或者组中间用逗号隔开,如果要加入一个组就用“@+组名”表示。)
#例子 write list = xiaozhao,@bob
# force user = nobody # 这句话一定不能出现,否则任意用户可以写
printable = no
### 此方案下,只有特定的用户可以放文件,其他人不能删除,可以访问。
# [seo]
# comment = save remote web site log file for seo
# path = /share/seo
# public = yes
# guest ok = yes
# browseable = yes
# writable = yes
# write list = nobody meishu # 两个帐号可以写入
# force user = nobody # 写入的文件所有者为nobody,匿名用户也可以删除,防止了有两个帐号写入,造成的文件所有者不统一的问题。
# printable = no
#
关于打印机的暂不介绍了,要指的注意的几点就是在windows访问,用可执行的用户必须要映射网络驱动器,而且如果驱动正在用,则链接不上,而且需要双权限。
安装直接
yum install samba 就可以了 我的环境是centos7.2