1.安装服务
[root@client ~]# yum install samba samba-common samba-client.x86_64 -y
[root@client ~]# systemctl start smb nmb
[root@client ~]# systemctl enable smb nmb
2.添加用户
[root@client ~]# smbpasswd -a student ##添加student用户
New SMB password: ##输入smb当前用户密码
Retype new SMB password: ##确认密码
Added user student.
[root@client ~]# pdbedit -L ##列出所有用户名
student:1000:User student[root@client ~]# pdbedit -x student ##删除用户名
[root@client ~]# setsebool samba_enable_home_dirs=1 ##在selinux上设置布尔值使smb用户可以访问自己的家目录
3.共享目录设定
[root@localhost ~]# vim /etc/samba/smb.conf
[haha] ##共享名称
comment = local directory ##对共享目录的描述
path = /smbshare ##共享目录的绝对路径
当共享目录为用户自建目录时
当共享目录为系统建立目录时
匿名用户
访问控制
valid users = ##当前共享的有效用户
valid users = westos ##当前共享的有效用户
westos valid users = @westos ##当前共享的有效用户为westos组
valid users = +westos ##当前共享的有效用户为westos组
读写控制
所有用户均可写
- 1
- 2
- 3
- 4
- 1
- 2
- 3
- 4
设定指定用户可写
- 1
- 2
- 3
- 4
- 5
- 1
- 2
- 3
- 4
- 5
smb多用户挂载
在client上
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
测试