配置samba服务器,创建共享目录/sharesmb,属于组groupsmb的具有读写的权限,其他成员只有读的权限。

 

1.环境设置

hostnamectl set-hostname fengxiaoli41.com

systemctl stop firewalld.service

systemctl disable firewalld.service

setenforce 0

2.下载samba

yum install -y samba samba-client

3.创建目录和组

mkdir -p /sharesmb

groupadd -r groupsmb

chown .groupsmb /sharesmb/

chmod 2775 /sharesmb/

semanage fcontext -a -t samba_share_t '/sharesmb(/.*)?'

restorecon -Rv /sharesmb/

4.修改主配置文件

vim /etc/samba/smb.conf修改

workgroup = MYGROUP

security = user

passdb backend = tdbsam

[sharesmb]

path = /sharesmb

write list = @groupsmb

5.新建用户fengxiaoli并且加入groupsmb

useradd -s /sbin/nologin -G groupsmb fengxiaoli

smbpasswd -a fengxiaoli

新建用户cx不加入组

useradd -s /sbin/nologin cx

smbpasswd -a cx

6.重启服务

firewall-cmd --permanent --add-service=samba

systemctl restart smb nmb

7.windows上登录测试

windows上用\\192.168.1.10登录

net use * /d (清楚用户登录信息)