SAMBA-多用户SMB挂载vim
一、samba服务器配置centos
[root@localhost~]# vim /etc/samba/smb.conf 服务器
[gongxiang]app
path = /apps/test #共享路径ide
writable = no #写权限centos7
write list = wang,magespa
[root@localhost ~]#mkdir /apps/test #建立共享目录ci
二、建立samba用户it
建立用户wang、magetable
[root@localhost ~]# useradd –s/sbin/nologin wang
[root@localhost ~]# smbpasswd -a wang
[root@localhost ~]# useradd –s /sbin/nologin mage
[root@localhost ~]# smbpasswd -a mage
三、设置目录权限
[root@localhost ~]# setfacl –m u:wang:rwx /apps/test
[root@localhost ~]# setfacl –m u:nage:rwx /apps/test
四、客户端启用多用户挂载
[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
五、客户端多用户访问
[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服务