實戰案例2:實現不同samba用戶訪問相同的samba共享,實現不同的配置
#創建三個samba用戶,并指定密碼為magedu
useradd -s /sbin/nologin -r smb1
useradd -s /sbin/nologin -r smb2
useradd -s /sbin/nologin -r smb3
smbpasswd –a smb1
smbpasswd –a smb2
smbpasswd –a smb3
#修改samba配置文件
Vim /etc/samba/smb.conf
#在workgroup下加一行
config file= /etc/samba/conf.d/%U 說明:%U表示用戶名
[share]
Path=/data/dir
Read only= NO
Guest ok = yes
write list=@wheel
#針對smb1和smb2用戶創建單獨的配置文件
Vim /etc/samba/conf.d/smb1
[share]
Path=/data/dir1
Read only= NO 等價于writable = yes
Create mask=0644
#說明:默認為744
Vim /etc/samba/conf.d/smb2
[share]
path=/data/dir2
systemctl restart smb nmb
#用戶smb1,smb2,smb3訪問share共享目錄,看到目錄是不同目錄
smbclient //sambaserver/share -U smb1%magedu
smbclient //sambaserver/share -U smb2%magedu
smbclient //sambaserver/share -U smb3%magedu
本文鏈接:http://www.thecarconnectin.com/36014.html
網友評論comments