1

I want to limit the resources available to user by setting a limit on the number of inodes they can create. Is there a way to do this?

0

Sure can. Just use setup your system to use quotas like this as explained here; note the usrquota and grpquota in the fstab entry:

First, you should specify which filesystem are allowed for quota check.

Modify the /etc/fstab, and add the keyword usrquota and grpquota to the corresponding filesystem that you would like to monitor.

The following example indicates that both user and group quota check is enabled on /home filesystem

# cat /etc/fstab
LABEL=/home    /home   ext2   defaults,usrquota,grpquota  1 2

With that set, then use edquota as explained on that same page as well:

Use the edquota command as shown below, to edit the quota information for a specific user.

For example, to change the disk quota for user ‘ramesh’, use edquota command, which will open the soft, hard limit values in an editor as shown below.

# edquota ramesh

Disk quotas for user ramesh (uid 500):
  Filesystem           blocks       soft       hard     inodes     soft     hard
  /dev/sda3           1419352          0          0       1686        0        0

Once the edquota command opens the quota settings for the specific user in a editor, you can set the following limits:

  • soft and hard limit for disk quota size for the particular user.

  • soft and hard limit for the total number of inodes that are allowed for the particular user.

And if your system does not have edquota installed, you can install it like this. For example, to install it on Ubuntu just run this apt-get command:

sudo apt-get install quota

On CentOS you would need to install it via yum like this:

sudo yum install quota

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.