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?
2 Answers
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:
- Install the quota tools:
apt-get install quota
- Add the
usrquota
mount option to the relevant filesystem in/etc/fstab
. - Remount the filesystem (reboot,
umount
/mount
, ormount -o remount,usrquota
). - Create the filesystem quota database with
quotacheck -uc /mountpoint
. - Use the
edquota
command to set an appropriate quota for each user. (I suggest doing this in a loop with a lot of users!)
-
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– NetoricaJan 18, 2018 at 4:51
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
ulimit
being able to set a max file size that can be copied or created.