Setting up disk quota on ubuntu for multiple users

Solution 1:

One way would be to create a template user, use edquota to set the quota for that template user. Then use setquota -p template_user -u real_user /filesystem to assign the quota settings of template_user to real_user:

Something like this may work for you.

cat /etc/passwd | cut -d: -f 1 | grep ^prefix | \
    xargs -I{} -n 1 setquota -p template_user -u {} /filesystem

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

user1 block-softlimit block-hardlimit inode-softlimit inode-hardlimit 
user2 block-softlimit block-hardlimit inode-softlimit inode-hardlimit 
user4 block-softlimit block-hardlimit inode-softlimit inode-hardlimit 
user5 block-softlimit block-hardlimit inode-softlimit inode-hardlimit 
user5 block-softlimit block-hardlimit inode-softlimit inode-hardlimit 

Then use a command like cat above_file | setquota--batch /filesystem

There are lots of different ways you can hack out a quick script, just check the setquota man page.