LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Linux Answers > Security
User Name
Password

Notices


By tataiermail at 2007-06-21 03:52
DISK QUOTA
--------------------------------------------------------------------------------

USE
----------------------------
The quota package contains system administration tools for monitoring
and limiting user and or group disk usage per filesystem.

IMPLEMENTING QUOTA
----------------------------
Configure the Kernel with Quota support.
Install the quota package.
Edit /etc/fstab
Establish the quota files
Set quotas.
Turn on Quota checking.

Configuring the Kernel
----------------------
In order to support quotas, the kernel must have been compiled with CONFIG_QUOTA option enabled. Standard RHEL kernels include quota option.

Installing the Quota Package
-----------------------
Only one package is needed to enable Quota. That package is quota-<version>.rpm.
To get info on the package use :
rpm -qi quota.
the /etc/rc.d/rc.sysinit file performs the following steps when the systems is booted:
runs quotacheck on the root filesystem
runs quotacheck on all other local filesystems.
Turns on quota checking.

Revising /etc/fstab
-----------------------
to specify that the /home partition supports user and group disk quotas, revise its line as follows:
/dev/hda3 /home ext3 defaults, usrquota, grpquota 1 2

Once the partition options are revised, we must remount the partition. For example:
mount -o remount /home

Establishing the Quota files
-------------------------
After editing the fstab with quota entry, we must establish the quota files aquota.user and aquota.group in each such partition. Use the quotacheck command to do this.
quotacheck -avug
This command may require several minutes to complete its task of accumulating and storing a record of the disk space used by each user and group.
To avoid Denial of Service Attack the files should be readable and writable by root only.

Setting Quotas
--------------------------
To set quota for a user, issue the command
edquota -u user
where user is the login name of the user. The edquota command launches the defaulkt editor(specified by the $EDITOR env var)
Example:
Disk quotas for user sumanc (uid 500):
Filesystem blocks soft hard inodes soft hard
/dev/hdd2 944 0 0 110 0 0

To specify a limit, change the appropriate number, save the file, exit he editor. A limit of 0 means no limits.
To verify that the quota has been set, issue:
quota -u sumanc

Setting a Group Quota
To specify a group quota, issue:
edquota -g group
To verify, issue:
quota -g group

Setting the grace period
edquota -t
Setting quotas for Multiple Users
1.Issue the command:
edquota -p user # This establishes specified user a/c as a template.
2.Issue the command:
edquota -p user user1 user2 ....
Turning On Quota checking
Quota checking will be activated when the system reboots, but without reboot also we can turn on quota checking by issuing the following command:
quotaon -av # this command turns on both user and group quotas
quotaon -avu # this turns on only user quotas. Similarly quotaon -avg will group quota.
To turn off quotas, issue the command
quotaoff -av | quotaoff -avu | quotaoff -avg

Administering Quotas
-----------------------
once quotas are up & running, we can use the commands that report the status of quotas. To view the status of quotas for multiple users, issue the command:
repquota -a

Example:
[root@srv home]# repquota -a
*** Report for user quotas on device /dev/hdd2
Block grace time: 00:01; Inode grace time: 00:01
Block limits File limits
User used soft hard grace used soft hard grace
---------------------------------------------------------------------------------------
root -- 17640 0 0 4 0 0
sumanc -- 44 380 400 10 490 500
amitdas +- 484 380 400 7days 10 0 0
siddas -- 48 380 400 11 0 0
** Users in violating condition are flagged with a + sign.
QUOTA ON NFS SHARE
On a NFS exported directory, simply apply the desired limits to the local users that are mapped with the remote users.


  



All times are GMT -5. The time now is 01:14 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration