参考
参考2
# 安装smb
yum install samba
# 配置
vim /etc/samba/smb.conf
#这步不能修改 配置文件不认share
security = share
#修改工作组为WORKGROUP ——》 windows 能访问
workgroup = WORKGROUP
# 设置共享名称
echo "[opt]" >>/etc/samba/smb.conf
echo " comment = data share" >>/etc/samba/smb.conf
echo " path = /opt" >>/etc/samba/smb.conf
echo " browseable = yes" >>/etc/samba/smb.conf
echo " writeable = yes" >>/etc/samba/smb.conf
echo " guest ok = on" >>/etc/samba/smb.conf
echo " read only = no" >>/etc/samba/smb.conf
参数说明:
(a)path:共享的目录
(b)browseable:是否允许在工作组里面(no:网上邻居看不到你的)
(c)public:公开的 public,因为匿名任何人都能访问,所以要yes
(d)writetable:可写
(e)comment = share for users:自定义描述
(f)guest ok = yes #允许匿名访问
(g)directory mode = 0777 ;默认创建目录的权限
# 启动
systemctl start nmb
systemctl start smb
# 查看状态
systemctl status smb.service
systemctl status nmb.service
smbd -F -S 查看samba启动失败的原因,(这条命令可以直接看出出错的原因,并且系统会给出修改建议,很多情况下都是有些文件夹的权限不对)
#系统里要有账号
pdbedit -a xxx
#访问密码要单独设置,不是系统密码
12345678
#windows访问
运行输入: \\192.168.131.110