I have a separate /home partition with ext4 filesystem. I have about 200 users whose usernames have a common prefix (e.g. 2010...). I have to allot 500 MB space limit (hard limit) for each users home directory. Instead of specifying space one by one I want to set the limit on one go by making use of the username prefix. How can it be done?
One way would be to create a template user, use edquota to set the quota for that template user. Then use
Something like this may work for you.
You could build a file with the a list of the users and the settings so you can use the --batch option. Create a file that looks like
Then use a command like
There are lots of different ways you can hack out a quick script, just check the setquota man page.