Welcome to the Linux Foundation Forum!

I cannot get quota to work for groups.

Hi.

I have sort of sussed quota for users but groups in not working. This is my pattern:

Create new user 'David'.
Create new group called 'managers'.
Add David to Manager group.
Make a directory in root called DIR1
Chown of the DIR1 so that managers is group
Chmod so that managers group can write to DIR1.
Add partition to /etc/fstab with 'grpquota' option with mountpoint DIR1.
DO mount -a to check fstab.
Reboot.
Do sudo quotacheck -cgv /DIR1
Do sudo quotaon -av
Do sudo edquota -g managers to edit the quotas for managers group.

Now when I log in with user David and cd to DIR1 I can make as many files as I want even though I have setup edquota for the managers groups.

What am I doing wrong?

Comments

  • lee42x
    lee42x Posts: 364

    Hello WarrenUK,
    When user "David" creates a new file in directory "DIR1" , what group affiliation is assigned to the file? It looks like it would be group "David" as that is the default creation group in the /etc/passwd for that user. Use the "id" command to verify. The first group in the list is the default creation group.

    To change the group affiliation of the newly created files/directories in a directory to be the same as the owner of the directory (/DIR1) set the "SGID" bit on the directory.
    "chmod g+s /DIR1 " should do the trick.

    SGID and SUID are described in the "Local System Security " section.

    Our quota example uses "usrquota" as the SGID bit has not been discussed yet.

  • Thanks for your help Lee I think I cracked it :)

  • Hi.

    I have another question.

    If you were going to set up a shared folder for a project would you create a specific account to own the folder? If you don't create a specific account to own the folder who would own it?

  • Hi @WarrenUK ,

    If the second question is not related to the original one, please do it in another thread. So when somebody search the forum, he/she can find useful information about the topic in question.

    Many regards,
    Luis.

  • WarrenUK
    WarrenUK Posts: 72
    edited September 2020

    OK I'll make a thread.

  • Ok, no problem. Let's say you want to create a shared directory on /mnt/data . So you can create the directory as root or using sudo (and in both cases the owner will be root). Then you will need to specify permissions on that directory. You also can change the group to another one, if you want to work with a specific group.

    I hope that helps.
    Luis.

Categories

Upcoming Training