1.安装samba
sudo yum install samba
2.环境配置
a.关闭防火墙
sudo systemctl stop firewalld.service #停止firewall
sudo systemctl disable firewalld.service #禁止firewall开机启动
b.关闭SELinux(以前在ubuntu上因为没这个所以不要关,CentOS上必须关,不然没权限访问用户目录)
sudo setenforce 0 #关闭selinux sudo vim /etc/selinux/config #启动时禁止,将SELINUX=enforcing改为SELINUX=disabled
3.添加samba用户
sudo smbpasswd -a username
4.配置samba文件
[global] security = user [centos7] comment = root Directories valid users = username path=/ browseable = yes writeable = yes create mask = 0655 directory mask = 0755 public = yes guest ok = yes
5.设置samba服务开机启动
sudo systemctl enable smb
6.启动 or重启samba
sudo service smb restart