Create of the quota.user and quota.group

Securing and Optimizing Linux: RedHat Edition -A Hands on Guide
Prev | Chapter 20. Set Limits using Qouta | Next

# 20.2. Create of the `quota.user` and `quota.group`

After the modification of your `/etc/fstab` file, in order for quotas to be established on a file system, the root directory of the file system i.e. `/home` in our example must contain a file, owned by root, called `quota.user` if you want to use user quota, `quota.group` if you want to use group quota, or both if you want to use users and group quota.

1. Create the `quota.user` and/or `quota.group` files, as root go to the root of the partition you wish to enable quota i.e. `/home` doing:

                         [root@deep] /# touch /home/quota.user
                         [root@deep] /# touch /home/quota.group
                         [root@deep] /# chmod 600  /home/quota.user
                         [root@deep] /# chmod 600  /home/quota.group

   The touch command will create new empty files under the `home` directory named `quota.user` and `quota.group`. The chmod command will set the mode of these files to be read-write only by the super-user root.

   > : Both quota record files, `quota.user` and `quota.group`, should be owned by root, with read-write permission for root and none for anybody else.

2. Now we must initialize the files `quota.user` and `quota.group` in the root directory of the file system in order to not receive an error messages about quota during the reboot of our server. To initialize `quota.user` and/or `quota.group` files, use the following commands:

                         [root@deep] /# edquota -u wahib
                         [root@deep] /# edquota -g wahib

   The steps above are necessary just to initialize the files `quota.user` and/or `quota.group`; the command edquota -u will edit the quota for the user wahib and -g will edit the quota for the group wahib. Note that you must edit an existing UID/GID on your system to initialize the files successfully.

3. After you have finished setting the appropriate options for your quota program in the `/etc/fstab` file, and created and initialized the `quota.users`, and/or `quota.group` files, you must reboot the system for the changes you have made in the `/etc/fstab` file and/or the files `quota.user`, `quota.group` to take effect. To reboot your system, use the following command:

                         [root@deep] /# reboot

After your system has been rebooted you can assign quotas to users or groups of users on your system. This operation is performed with the edquota command. See man page edquota(8)

Prev | Home | Next
Qouta | Up | edquota