1、关闭防火墙。CentOS 7 是自带的firewall，CentOS 6 好像是iptables。关闭防火墙命令如下：第一种方法是关闭防火墙：systemctl disable firewalld.service第二种方法是添加规则：firewall-cmd --permanent --zone=public --add-service=samba firewall-cmd --reload2、关闭selinux1、安装yum install samba samba-client samba-common -y2、配置备份已有配置mv /etc/samba/smb.conf /etc/samba/smb.conf.bkp添加新的配置vi /etc/samba/smb.conf输入以下内容[global] workgroup = WORKGROUP server string = Samba Server %v netbios name = centos security = user map to guest = bad user dns proxy = no #============================ Share Definitions ============================== [Public] path = /data/share/ writable = yes browsable = yes guest ok = yes guest only = yes create mode = 0777 directory mode = 0777注意：在samba4中 share 和 server已经被禁用，需要用 security = user 和map to guest =Bad User来实现无密码访问目录配置启动服务mkdir -p /data/share/public systemctl enable smb.service systemctl enable nmb.service systemctl restart smb.service systemctl restart nmb.service设置防火墙firewall-cmd --permanent --zone=public --add-service=samba firewall-cmd --reload修改目录访问权限chmod -R 0777 /data/share/public chown -R nobody:nobody /data/share/public