Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a simple set-up with just one public share on my configuration file. How can I restrict its size?

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

There are a couple of ways to achieve this.

  • The general method for applying proper per-user quotas is to configure a Linux quota (similar how-to for Ubuntu 7.x) on all users that access the public share. Samba doesn't handle the quotas directly; the quotas are applied to the users on a given filesystem, meaning the effective UID that their Samba connections operate as, which might be guest or nobody for a public share.

  • A simple way to restrict the size is put your public share on its own small filesystem. Create a partition from free space on your harddrive, format it, mount it somewhere, and move your share to somewhere under that mountpoint. If your users fill that filesystem, they'll have filled their "quota", and other partitions on your system won't be affected.

  • A hackish way that I think will work is to create a virtual filesystem (imagine an ext3-formatted ISO image) in the maximum size for the share. This is basically the same as above, except instead of a separate partition, you've just created a single file of, say, 10GB (if you want 10GB of space available to the share). You'll mount that image file as a loopback device, and place the share under its mountpoint. Again, you don't have to configure a quota; the filesystem size is set when you create the image file, and if your users fill it up it won't impact the rest of the system.

share|improve this answer
add comment

Samba has a wonderful configuration tool called "SWAT" If you enable that, you can see all the options you can set specific to Samba. I don't have a Samba Server set up, but if you look in there, I think you can set the Samba-specific quotas there.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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