[Nottingham] limiting a user's quota

Graeme Fowler graeme at graemef.net
Mon Feb 9 21:24:59 GMT 2004


Hiya

On Mon, 2004-02-09 at 19:48, danny wrote:
> I have just set up a ftp server and i need to limit the ammount of space users 
> can take up.
> How can i do this? example: i want to let /home/temp use 100mb and no more.

It's cat-skinning time again - ie. there's a 101 ways to do this :)

1. User quotas
Make sure that the filesystem your users' files will go into is mounted
with option "usrquota", and that quotas are turned on and set. "man
quota" should help you here.
This way, you limit each user to NNN amount of space on that filesystem,
and the kernel limits them by applying the limits for you.

2. Group quotas
Put all your FTP users in the same group and apply a group quota.
Caveat: one user can ruin it for everyone. Same rules apply as above,
except the option is "grpquota".

3. FTP server quota support
Some FTP servers cam limit space themselves, regardless of the existence
or otherwise of system quotas. I am unsure as to what can do this,
however.

4. File system "images".
Create yourself a (say) 100MB file:
dd if=/dev/zero of=/home/userfile bs=1M count=100

Make a filesystem on it:
mke2fs -j /home/userfile
(you may get warning about it not being a block device, but these can
usually be ignored safely)

Mount that as a loop device:
mount -o loop /home/userfile /home/tmp

...and that way you physically size the "partition" so that it's not
actually possible, quotas or not, to exceed the filesystem size.

HTH

Graeme
-- 
Graeme Fowler <graeme at graemef.net>



More information about the Nottingham mailing list