User quotas with Ubuntu

This step by step tutorial shows how to install and implement user quotas, to limit disk space available for selected users in a Linux system (tested on Ubuntu, using repositories).To add support for user disk quotas on Ubuntu:

Install quota from repository:
sudo apt-get install quota
Edit, as root, /etc/fstab adding usrquota and grpquota to desired partitions:
/dev/hda3       /home           ext3    defaults,usrquota,grpquota        0       2
Reboot the system.
Then

sudo edquota -u username -f /dev/desiredpartition
Editing the file:
Disk quotas for user username (uid 1050):
  Filesystem                   blocks       soft       hard     inodes     soft     hard
  /dev/hdaN                         0     31457280     31457280          0        0        0
Save that file… now do:
sudo edquota -t -f /dev/hda3
set grace periods to 0 seconds like this:
Grace period before enforcing soft limits for users:
Time units may be: days, hours, minutes, or seconds
  Filesystem             Block grace period     Inode grace period
  /dev/hda3                  0seconds               0seconds
Save, and finally:
quotaoff -a
Code:
quotaon /dev/hda3
Advertisements