Samba共享仅对来宾具有只读权限,对经过身份验证的用户具有读写权限


18

是否可以将Samba共享仅对来宾进行只读,而对经过身份验证的用户进行读写操作?

如果我允许来宾共享,则不会提示我输入密码,而是以具有只读权限的来宾身份有效登录。但是我想通过身份验证,以便我也可以写。

谁能提供一个示例smb share节来实现这一目标?

Answers:


18

编辑 /etc/samba/smb.conf

# command line
sudo -e /etc/samba/smb.conf

# graphical
gksu gedit /etc/samba/smb.conf

write list共享定义中添加参数,在允许写访问权限的用户列表中添加。

write list = user1 user2 user3

您可以使用read list,以及

read list = guest, nobody

所以...

[share]
comment = Ubuntu Share
path = /your/samba/share
browsable = yes
guest ok = yes
read only = yes
write list = user1 user2 user3
create mask = 0755

如果需要更好的控制权,则可以在服务器上使用acl(访问控制列表)。


2
那行不通:lp_bool(guest nobody): value is not boolean!
reox

1
这个答案是错误的。read only只能是 yesno,不能使用用户名或组作为其值。
sdkks 16-10-28

我试着设置read onlyguest nobody的建议,但它所作的只是移除访客访问我的共享干脆,好像guest ok已经no。使用write list工作就像一种魅力,仅可惜我必须为我添加的每个新用户更新它。
Hubro

9

只读参数是一个布尔值,因此它应该更像以下之一:

[share]
comment = Ubuntu Share
path = /your/samba/share
browsable = yes
guest ok = yes
read only = no
read list = guest nobody
write list = user1 user2 user3
create mask = 0755

[share]
comment = Ubuntu Share
path = /your/samba/share
browsable = yes
guest ok = yes
read only = yes
write list = user1 user2 user3
create mask = 0755
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.