Centos 文件服务器的搭建 Samba

Linux文件服务器的搭建

1. 关闭SELinux, 防火墙

1
2
3
4
5
setenforce 0
getenforce
vim /etc/sysconfig/selinux #SELINUX=enforcing 改成 SELINUX=disable
systemctl stop firewalld.service
systemctl disable firewalld.service

2. 安装软件

1
yum install -y samba samba-client

3. 编辑配置文件,共享/var/www/html/目录

1
2
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
vim /etc/samba/smb.conf

​ 在这里插入

1
2
3
4
5
[share]
comment = It is a test
path = /var/www/html
browseable = yes
writable = yes

4. 创建共享用户

1
2
3
4
useradd van
smbpasswd -a van
#输入 密码
pdbedit -L #查看共享用户

5. 启动服务

1
2
3
4
systemctl start smb # 启动服务
systemctl enable smb # 开机自启

ss -antp | grep smbd #查看是否运行

6. 设置目录的本地权限

1
2
3
setfacl -m u:root:rwx /var/www/html

setfacl -m u:(用户):rwx /(目录)