建立共文件
mkdir /testdir
chmod 757 /testdir
vim /etc/samba/smb.conf#配置
配置内容
[testdir]
comment = share testdir #说明
path = /testdir
browseable = Yes
hosts allow = 192.168.11.0/24 #设置可访问ip网段
valid users = usr1,usr2#设置可访问用户
writable = no
write list = usr2#设置usr2可写入
public = no
重启服务
systemctl restart smb nmb
生成samba用户
- 建系统用户
user add usr1
user add urs2 - 转系统用户为samba用户
smbpasswd - usr1
smbpasswd -usr2
linux下共享
yum -y install smbclient
smbclient //192.168.11.66/testdir -U usr1%123456 #%后是密码。
linux下挂载
mkdir /mnt/share_test
mount -o username=usr1 password=123456 -t cifs //192.168.11.66/testdir /mnt/share_test
mount
windows下共享
\\192.168.11.66\testdir