LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-10-2021, 03:18 PM   #1
stoorky
Member
 
Registered: Sep 2015
Posts: 63

Rep: Reputation: Disabled
Is “obey pam restrictions” still supposed to work in Samba 4 ?


Hi,

Working on Debian Buster 10.7 / Samba 4.9

The up-to-date Samba doc says (https://www.samba.org/samba/docs/cur...mb.conf.5.html) :

Quote:
When Samba 3.0 is configured to enable PAM support (i.e. --with-pam), this parameter will control whether or not Samba should obey PAM's account and session management directives.
Is this still supposed to work with Samba 4 ?

I had some strange result, it seems PAM's restrictions are enforced once, but then not anymore.

I tried to set up a file-size limitation on a Samba share. I'm not talking about quotas, I'm talking about preventing users from storing files that are bigger than 100MB, for example. I used /etc/security/limits.conf for this.

It almost works. Well, it works the first time a user tries to create a file, and then not anymore.

Here's what I did :

- First I defined a hard filesize limit of 100MB for user johndoe in /etc/security/limits.conf :
Code:
johndoe    hard    fsize    102400
- Then I added
Code:
session required pam_limits.so
to /etc/pam.d/samba, in order to tell PAM to enforce the limitations


- And finally, I added
Code:
obey pam restrictions = yes
to /etc/samba/smb.conf

At first it seemed promising, when user johndoe tries to copy a file > 100MB, a Windows 10 client throws the following error :
Quote:
An unexpected error is keeping you from copying the file...An unexpected network error occured
(see screenshot)

So far, so good ! That's what I wanted, prevent the user to store a file > 100MB

But if I click on "Try again", the file is copied anyway.

And if I then try to copy more files > 100MB, no more error message is thrown, and the copies proceed.

If user johndoe logs out and back in, same result : the first attempt at copying a file > 100MB throws an error, the following attempts succeed.

So, it seems the restriction I set in /etc/security/limits.conf is only enforced at the first attempt, and is no more enforced afterwards.

Any idea why ? Or any idea how I could achieve my goal (prevent a user to copy a file > 100MB) ?
 
Old 02-10-2021, 04:04 PM   #2
stoorky
Member
 
Registered: Sep 2015
Posts: 63

Original Poster
Rep: Reputation: Disabled
OK I got a straight answer from the Samba team

Basically, to sum things up, setting up a limit for individual file size can not be done with Samba

The full discussion can be found in the february mailing list archive (https://lists.samba.org/archive/samb...ebruary.txt.gz)
 
  


Reply

Tags
pam, samba4



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc/pam.d/system-auth-ac vs. /etc/pam.d/password-auth-ac vs. /etc/pam.d/sshd christr Red Hat 2 08-01-2014 07:08 PM
pam time restrictions not working !!? kingston Linux - Newbie 17 09-02-2010 07:10 PM
PAM time restrictions - changing Time.conf so it gets time from sql table noodlesoffire Linux - Newbie 1 04-04-2010 04:41 PM
using pam to override file access restrictions gearoid_murphy Linux - General 7 08-26-2009 03:43 AM
Get pam time restrictions working for linux samba domain login. v2ueha6 Linux - Newbie 1 12-20-2008 03:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration