config group quota for smb shares in Ubuntu

1) sudo vim /etc/fsftab
Edit the corresponding filesystem entry as below (add "grpquota"):
/dev/mapper/lpfs-root  /   ext4    grpquota,errors=remount-ro 0    1

2) Remount the file system
sudo mount -o remount,grpquota /

3) Turn on the quota checking
sudo quotacheck -F vfsv0 -c -a -v  -g -m

4) Create group and add user to group
     a. Create group by using "groupadd" if necessary.
     b. Add users to specific groups by using usrmod

5) Config group quota
sudo edquota -g lpadmin  # fill the soft limits and hard limits for both  block and inode, for eg.

Disk quotas for group lpadmin (gid 113):
  Filesystem                                          blocks       soft                  hard               inodes     soft     hard
  /dev/mapper/LPTeam--FS-root  242674996  943718400  943718400      27722        0        0

6) Create smb shares, users with specific group. The following is an example for two share dirs with two different groups.
[LPShare]
comment = 'this is LP file share'
path = /home/administrator/LPShare
public = yes
writable = yes
valid users = chenk6
create mask = 0777
directory mask = 0777
force user = nobody
force group = lpadmin     <== which means, when writing files to this share, the files will fall into "lpadmin" group automatically
available = yes
browseable = yes

[NERes]
comment = 'this is NERes file share'
path = /home/administrator/NERes
public = yes
writable = yes
valid users = NERes
create mask = 0777
directory mask = 0777
force user = nobody
force group = NERes
available = yes
browseable = yes

7) Restart smb service.

Reference:
http://www.thegeekstuff.com/2010/07/disk-quota/#more-5093

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值