samba客户端连进来后,新建目录设置的权限都是0775,我修改了smb.conf配置文件中的directory mask = 0777
都无效,如下:
[share]
path = /home/ai2/vismarty/images4detection
valid users = aoi,rongxin-samba
available = yes
browseable = yes
writable = yes
public = no
guest ok = no
create mask = 0777
force create mode = 0777
directory mask = 0777
force directory mode = 0777
找了好久原因,终于再谷歌的一篇文章中找到解决办法,即如下配置:
[global]
inherit permissions = yes
[share]
path = /home/ai2/vismarty/images4detection
valid users = aoi,rongxin-samba
available = yes
browseable = yes
writable = yes
public = no
guest ok = no
create mask = 0777
force create mode = 0777
directory mask = 0777
force directory mode = 0777
# for windows admin permission
security mask = 0777
force security mask = 0777
directory security mask = 0777
force directory security mode = 0777
过了一阵子,发现还是会有新建的文件不是777权限,最后这样解决的:
[global]
inherit permissions = yes
[share]
path = /home/ai2/vismarty/images4detection
valid users = aoi,rongxin-samba
force users = admin
available = yes
browseable = yes
writable = yes
public = no
guest ok = no
force users = admin
强制将登陆samba后的用户改为admin,和ubuntu的登陆用户一致,这样就不会产生权限问题。
官方说明:
force user (S):
This specifies a UNIX user name that will be assigned as the default user for all users connecting to this service. This is useful for sharing files. You should also use it carefully as using it incorrectly can cause security problems.