Wednesday, March 19, 2008

How do I configure and manage system user quota on my RedHat server with no control panel?

To configure or manage user quotas on a RedHat server with no control panel installed, follow the steps below:
1. Understanding the user's quota file structure.
Below is an example of a user's quota file:
Disk quotas for user bob (uid 501):
Filesystem blocks soft hard inodes soft hard
/dev/hda2 1944 0 0 120 0 0

Each column represents the following(working from left to right):
* Filesystem - Linux filesystem that you are configuring quotas on for the specific user.
* Blocks - Number of blocks(Kilobytes) the user is currently using.
* Soft - The soft limit for the amount of blocks(Kilobytes) the user can use. The soft limit can be surpassed up the hard limit, but only for a specified grace period which is also configurable.
* Hard - The hard limit for the amount of blocks(Kilobytes) the user can use. The hard limit is the maximum limit that can be used by the user and cannot be surpassed.
* Inodes - Number of inodes the user is currently using. An inode is used for every file or directory on a linux filesystem. Limiting the number of inodes is usually not as important to most system administrators as limiting block usage, however it isn't a bad idea to limit a user's inode usage too as a filesystem can run out of inodes(which will deny the server from creating any new files or directories).
* Soft - The soft limit for the amount of inodes the user can use. The soft limit can be surpassed up to the hard limit, but only for a specified grace periond which can be changed.
* Hard - The hard limit for the amount of inodes the user can use. The hard limit is the maximum limit that can be used by the user and cannot be surpassed.

2. Defining or editing the quota limits for a user.

To define or edit a user's quota limits on your RedHat server, use this command:
edquota -u
example: edquota -u bob
After executing the edquota command, it will bring up the specified user's quota file(shown in step 1) in the popular editor 'vi'(for more information on how to use vi, please see our knowledgebase article pertaining to such). Change the soft/hard limits for the user's block and inode usage as you see fit. Setting any of the user's limits to '0' provides unlimited usage for that particular setting. Once you are finished setting the user's limits, save and exit the file which will instate the new settings immediately.

3. Viewing a user's quota limits.

To view the changes you've just made or to view any user's current quota limits, use the command below:
quota -u
example: quota -u bob
Also, to see a summary of all of your system user's quota usage, use this command:
repquota -a

No comments: