- SMB实现linux与windows文件共享
所有操作之前安装samba
yum install samba
(1)检查当前是否为user验证模式
security = user
passdb backend = tdbsam
(2)创建共享文件夹
mkdir /home/fate/sharedir
(3)添加共享文件夹信息(主要该path)
vi /etc/samba/smb.conf
[fate0729]
comment=Do not arbitrarily modify the database file
path=/home/fate/sharedir
public=no
writable=yes
[sharedir]
comment=Do not arbitrarily modify the database file
path=/home/fate/sharedir
public=no
writable=yes
(4)保存smb.conf文件后重启SMB服务
systemctl restart smb
(5)添加开机启动项
systemctl enable smb
(6)清空防火墙规则链
iptables -F
service iptables status
增加samba用户提示Failed to add entry for user
解决办法:
这是因为没有加相应的系统账号,所以会提示Failed to add entry for user的错误,只需增加相应的系统账号test就可以了:
创建具备 root 权限的用户test 并修改其密码。
useradd -g root -G root test
passwd test
添加smb用户:smbpasswd -a test
查看用户:pdbedit -L
挂载命令参考:
mount -t cifs -o username=test,password=123456 //172.17.20.112/local-disk2 /mnt/data/remote/112disk2