Create User Quota on Centos 7

Create User Quota on Centos 7

                      Create User Quota on Centos 7

In Centos 7 user group quota not enabled by default we have to enabled them manually.

To check whether quota is enabled or not, we can use below command:

# mount | grep ‘ / ‘

The command output shows the root file system is enabled without quota as mentioned by the noquota

in the output.

Now we have to enable quota on the root(/) file system and to do that, we have to first edit the file /etc/defualt/grub and add the following to GRUB_CMDLINE_LINUX:

rootflags=userquota, grpquota

In file GRUB_CMDLINE_LINUX should be read as follows:

To reflect changes that we have made in grub file. First we need to make backup of grub file using following command.

# cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.ori

Now we have to rebuild grub configuration file to reflect changes that we have made:

# grub2-mkconfig -o /boot/grub2/grub.cfg

After rebuild, reboot system and check changes are reflected or not with below command:

# mount | grep ‘ / ‘

Now, since quota is enabled, we will further install quota using the following to operate quota for different users and groups, so on:

# yum -y install quota

Once quota is installed, we check the current quota for users using the following

command:

# repquota -as

 

The preceding command will report user quotas in a human-readable format.

 

From the preceding screenshot, there are two ways we can limit quota for users and groups; one is setting soft and hard limits for the size of disk space used, and another is limiting the user or group by limiting the number of files they can create. In both cases, soft and hard limits are used. A soft limit is something that warns the user when the soft limit is reached, and the hard limit is the limit that they cannot bypass.

# edquota -u sunil

The preceding command output shall look like the following screenshot:

 

 

 

 

 

 

Leave a comment

Your email address will not be published.


*