Ubuntu安装Samba

场景:
a用户可以共享/data/share/a和/data/share/a/c;
b用户可以共享/data/share/b;
c用户可以共享/data/share/a/c;

备注:
testparm 检查语法
pdbedit smb操作
smbpasswd smb操作 smbpasswd -a xxx 修改xxx用户密码
windows清理链接的smb执行如下cmd && net use * /del
步骤:
1、安装服务
apt-get install samba
2、修改/etc/samba/smb.conf
[global]
security = user#需要添加该行内容
#以下内容放文件末尾
[a]
comment = a share
path = /data/share/a
public = yes
writable = yes
valid users = a
create mask = 0775
directory mask = 0775
force user = www-data
force group = www-data
available = yes
browseable = yes
[b]
comment = b share
path = /data/share/b
public = yes
writable = yes
valid users = b
create mask = 0775
directory mask = 0775
force user = www-data
force group = www-data
available = yes
browseable = yes
[c]
comment = c share
path = /data/share/c
public = yes
writable = yes
valid users = a,c
create mask = 0775
directory mask = 0775
force user = www-data
force group = www-data
available = yes
browseable = yes
3、添加用户
useradd -g www-data -G www-data a
useradd -g www-data -G www-data b
useradd -g www-data -G www-data c
smbpasswd -a a #输入两次密码
smbpasswd -a b
smbpasswd -a c
4、验证是否可以使用
在windows我的电脑地址栏输入\\ip地址\a即可进入分享目录(提示输入密码则输入a用户相关密码)

备注:由于windows切换目录需要先断开同IP下的smb服务,所以需要执行cmd && net use * /del才能更换其他目录

Bookmark the permalink.

Comments are closed.