Securing-Optimizing-RH-Linux-1_2_219
Comments and suggestions concerning this book should be mailed to gmourani@videotron.ca
© Copyright 1999-2000 Gerhard Mourani and Open Network Architecture ®
219
Set Quota on your Linux system
Overview
Quota is a system administration tools for monitoring and limiting users' and/or groups' disk
usage, per file system. Two features of disk storage with quota are available to set limits: the
first is the number of inodes (number of files) a user or a group of users may possess and the
second is the number of disk blocks (number of space in kilobytes) that may be allocated to a
user or a group of users. With quota, the users are forced by the system administrator to not
consume unlimited disk space on a system. This program is handled on per user, per file system
basis and must be set for each file system separately.
Build a kernel with Quota support
The first thing you need to do is ensure that your kernel has been built with Quota support
enabled. In the 2.2.14 kernel version you need ensure that you have answered Y to the following
questions:
Filesystems
Quota support (CONFIG_QUOTA) [N/y/?] Y
NOTE: If you are follow the Linux Kernel chapter on this book and are recompiled your kernel, the
options Quota support show above is already set.
Modify the /etc/fstab file
The /etc/fstab file contains information about the various file systems installed on your Linux
server. Quota must be enabling in the fstab file before you can use it. Since Quota must be set for
each file system separately and because in fstab file, each file system is described on a separate
line, quota must be set on each of the separate line in the fstab you want to enable quota support.
With the program quota, depending of your intentions, needs, etc, you can enable quota only for
users, group or both (user and group). For all examples bellow we use the /home directory on
the /dev/sda6 partition and shows you the three possibilities.
Possibility 1:
·
To enable user quota support on a specific file system, edit your fstab file (vi /etc/fstab)
and add the "usrquota" option to the fourth field after the word "defaults" or any other
options you may have set for this specific file system.
As an example change:
/dev/sda6 /home ext2 defaults 1 2 (as an example: the word defaults)
/dev/sda6 /home ext2 nosuid,nodev 1 2 (as an example: any other options you have set)
To read:
/dev/sda6 /home ext2 defaults,usrquota 1 2
/dev/sda6 /home ext2 nosuid,nodev, usrquota 1 2
Possibility 2: