Welcome to ciysys blog

File & Directory

Published on: 22nd Apr 2014

Updated on: 12th Jan 2023

File & director operations

File & directory permissions


22.Sep.2022: Enable the storage quota for the user,

  1. If the user is allowed in accessing the server storage, you may want to limit their usage by setting a quota for them.

    sudo apt update
    sudo apt install quota
  2. To confirm that the quota feature has been installed, run this:

    quota --version
  3. Make sure that the quota module is in the OS.

    find  /lib/modules/ -type f -name '*quota_v*'

    In my virtual machine, I have this result,


    In case the file does not exist, try this:

    sudo apt install linux-image-extra-virtual

    This is for AWS server,

    sudo apt install linux-modules-extra-aws
  4. Edit the file system configuration,

    sudo nano /etc/fstab

    Replaced the 'defaults' word with 'usrquota,grpquota'.

    UUID=c474e3a1-a40f-4a66-becf-1fa084f95832 / ext4 usrquota,grpquota 0 0

    Notes: you may have different UUID value and it is ok.

  5. After that, we will have to remount the file system with the following command,

    sudo mount -o remount /

    To verify the changes, run the following command.

    cat /proc/mounts | grep ' / '

    I see the following result.

    /dev/sda2 / ext4 rw,relatime,quota,usrquota,grpquota 0 0

    Notes: you may have different value of '/dev/sda2' and it is ok.

  6. Now, we are ready to turn on the quota module,

    sudo quotacheck -ugm /

    Where 'u' is user, 'g' is group and 'm' is no remount.

    For more information about the paramters, please refers to https://manpages.ubuntu.com/manpages/bionic/man8/quotacheck.8.html

    This generates 2 files (aquota.group and aquota.user):

    tester@ubuntu11:~$ ls -la /
    total 132
    drwxr-xr-x  23 root root  4096 Sep 22 10:36 ./
    drwxr-xr-x  23 root root  4096 Sep 22 10:36 ../
    -rw-------   1 root root 10240 Sep 22 10:36 aquota.group
    -rw-------   1 root root  8192 Sep 22 10:36 aquota.user
    drwxr-xr-x   2 root root 12288 Feb  3  2022 bin/
    drwxr-xr-x   3 root root  4096 Feb  3  2022 boot/
  7. Reboot the server. This is to ensure that the server is able to start normally after the above changes.

  8. Finally, you may set the quota for the user. In the following example, I'll allocate 1GB storage space to myftpuserid account.

    sudo setquota -u myftpuserid 1G 1.2G 0 0 /

    Notes: the first 1G is the soft limit and then the 1.2G is the hard limit. The last two zero is to limit by the number of files.

  9. In case you want to review the quota usage, run the following commands.

    sudo repquota -s /


Related posts

Jump to #UBUNTU blog


Lau Hon Wan, software developer.