0

I just want to make sure my students to be uploading, creating or storing files not bigger than 8MB in our file repository. Is it possible for me to do it in ubuntu linux?

4
  • What kind of software is used for the file repository?
    – David
    Jan 18, 2018 at 4:20
  • @David well my users have all the SFTP access, it just they have non-root linux account each
    – Netorica
    Jan 18, 2018 at 4:30
  • A google shows references to ulimit being able to set a max file size that can be copied or created.
    – ivanivan
    Jan 18, 2018 at 5:33
  • checkout the bindfs solution on unix.stackexchange.com/questions/306913/… Jan 18, 2018 at 6:45

2 Answers 2

2

Since each user has their own Linux account, you could choose to limit disk usage by per-user quotas. This wouldn't limit individual file uploads, but would limit the total space available per user.

To do this, you need to:

  1. Install the quota tools: apt-get install quota
  2. Add the usrquota mount option to the relevant filesystem in /etc/fstab.
  3. Remount the filesystem (reboot, umount/mount, or mount -o remount,usrquota).
  4. Create the filesystem quota database with quotacheck -uc /mountpoint.
  5. Use the edquota command to set an appropriate quota for each user. (I suggest doing this in a loop with a lot of users!)
1
  • well it really fine for me that my users uploaded many files as long its is small as 8mb which is intended for our application
    – Netorica
    Jan 18, 2018 at 4:51
1

Depending on your infrastructure it might be possible for you to set a per user limit for files via ulimit -f, whereby it defines

The maximum size of files written by the shell and its children

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.