您的位置:首页 > 其它

SAMBA-多用户SMB挂载

2016-12-23 11:50 239 查看
SAMBA-多用户SMB挂载

1、samba服务器配置
[root@localhost~]# vim /etc/samba/smb.conf
[gongxiang]
path = /apps/test #共享路径
writable = no #写权限
write list = wang,mage
[root@localhost ~]#mkdir /apps/test #创建共享目录
2、创建samba用户
创建用户wang、mage
[root@localhost ~]# useradd –s/sbin/nologin wang
[root@localhost ~]# smbpasswd -a wang
[root@localhost ~]# useradd –s /sbin/nologin mage
[root@localhost ~]# smbpasswd -a mage

3、设置目录权限
[root@localhost ~]# setfacl –m u:wang:rwx /apps/test
[root@localhost ~]# setfacl –m u:nage:rwx /apps/test
4、客户端启用多用户挂载
[root@localhost ~]# yum install cifs-utils
[root@localhost ~]# mkdir /mnt/gx #创建挂载点
[root@localhost ~]# echo 'username=wang' >> /etc/smb #挂载用户密码文件
[root@localhost ~]# echo 'password=magedu' >> /etc/smb

[root@localhost ~]#vim /etc/fstab #自动挂载
//172.16.250.90/gx /mnt/gx cifs credentials=/etc/smb,multiuser,sec=ntlmssp0 0
[root@localhost ~]#mount –a
5、客户端多用户访问
[root@centos7_1 ~]# su - wang
Last login: Thu Dec 22 22:11:20 CST 2016 on pts/1
[wang@centos7_1 ~]$ cifscreds add 172.16.250.90
Password:
[wang@centos7_1 ~]$ cd /mnt/gx/
[wang@centos7_1 gx]$ touch test
[wang@centos7_1 gx]$
同理其他用户mage使用以上命令可以挂载smb服务
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  samba