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

你可能感兴趣的:(config group quota for smb shares in Ubuntu)