Reset FreeBSD Default Quotas

We recently changed policy to make the default webspace quota 1GB (up from 100MB!) which I posted about previously. What I overlooked was in the dim and distant past I had set a default quota for new users with the ‘edquota’ command. This is a short post on how to set it initially and ¬†how to change it afterwards.

First you need to decide on a prototype account, I chose my own and in the first instance set the quota as follows:

# edquota -u dan
#### TEXT EDITOR OPENS ####
Quotas for user dan:
/data: kbytes in use: 0, limits (soft = 100000, hard = 110000)
        inodes in use: 0, limits (soft = 0, hard = 0)

Here you see I set the quota to 100MB and hard omit of 110MB – very generous! The next step is to set the quota for a range of UIDs which can include UIDs not yet assigned – thats the important bit. Heres how to do that:

edquota -p dan 1002-5000

Now any new accounts created with UID of less than 500 will get the 100MB quota. So now we need to up the quotas on the new accounts. Well we had already used a perl script to do some quota manipulation previously so we don’t want to modify this accounts, so lets say we have reached UID 2000 and all accounts that are created from now on need the 1GB quota. First of all I’ll change the quota on the ‘dan’ account to 1GB with a 1.1GB hard limit and then run as follows:

edquota -p dan 2000-5000

Its worth noting that if you had users with UIDs greater than 2000 in existence then their quotas would be reset to 1GB by this process.

This entry was posted in FreeBSD Administration and tagged , . Bookmark the permalink.

Leave a Reply