2

Is there any possibilities to restrict Samba user's to a maximum file size?

Ex, If a samba-user uploads a file onto the server that's more than 100 MB (like video or compressed files), Samba, or the system receiving the file, should not allow it.

2

So there is a solution.

Considering Samba share size = 10GB

If you want an user not to use more than 1GB then you can use user quota management as described here

Now as of your question, you need to restrict copy and paste of your samba users, then follow the steps here,

# vi /etc/security/limits.conf

Edit this configuration file and append like this to all user whom you need to restrict

savvy       hard  fsize  102400

So the samba user savvy cannot file transfer beyond 100MB. For the changes to take effect logout and log back in or restart your system.

| improve this answer | |
  • 1
    Thanks for the replay, How about guest user ? I've enabled guest user on one of the share on Samba configuration. – Kumar Dec 17 '13 at 12:08
  • savvy hard fsize 102400 Change this line to guest hard fsize 102400 It would be great if you accept my answer and upvote as appreciating in this page. Thanks – Ruban Savvy Dec 17 '13 at 12:11
  • I've enabled these two things on my smb.conf, "public = yes, guest ok = yes". It'll create file with "nobody nogroup". So now how can I restrict with /etc/security/limits.conf ??? – Kumar Dec 17 '13 at 12:17
  • Same rule applies there, #cat /etc/passwd There you will see a user nobody, nobody hard fsize 102400 Will do the trick. ;) – Ruban Savvy Dec 17 '13 at 12:20
  • File restrict is not working with user nobady. how can I check whether limit applied or not, without copy a file ? – Kumar Dec 18 '13 at 9:26

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.