1.安装samba服务
yum install samba -y
2.设置samba服务开机启动
systemctl enable smb
3.启动samba服务
systemctl start smb
4.创建共享的文件夹
mkdir -pv /share/erptools
5.添加用户
useradd erpadmin
6.添加samba用户
pdbedit -a erpadmin
7.添加文件夹权限
setfacl -m u:erpadmin:rwx /share/erptools
8.检查Selinux设置[在这里被坑了,可以直接关闭掉selinux!]
getsebool -a | grep samba_export
9.设置selinux
setsebool -P samba_export_all_rw=on
setsebool -P samba_export_all_ro=on
10.samba服务配置文件 /etc/samba/smb.conf
需要用户验证:
[erptools]
comment = erp tools
path = /opt/erptools
writable = yes
write list = erpadmin
valid users = erpadmin
create make = 0664
directory make = 0775
不需要用户验证:
[company]
comment=share file
path=/company
public=yes
writable=yes
11.samba服务配置文件说明:
path = /smb/ //共享目录路径
public = yes|no //默认no;公用的
browseable = yes|no //默认yes;是否可以浏览
read only = yes|no //默认yes;只读
writable = yes|no //默认yes;可写
write list = user //默认无;可写入的用户列表
valid users = user,user1//默认所有用户;有效的用户列表
hosts allow = 客户地址 //允许的客户机地址
hosts deny = 客户地址 //禁止的客户机地址
comment = 注释 //说明