samba server中设置了新建目录权限无效的问题

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.

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值