11

testparm in samba may produce this message:

rlimit_max: rlimit_max (8192) below minimum Windows limit (16384) 

This appears be be resolved by increasing the max open file limit using this Linux command ulimit -n 16384..

Is this a safe change for the typically Samba box? Where should this setting be stored so that it will be available to the samba service on boot?

jcalfee
  • 331
  • 3
  • 7
  • 13

4 Answers4

9

First off, this is just a warning. On MS Windows the number of file handlers on the client and the server must be identical, else you will see the "too many files open" message when e. g. copying files over the network. More recent Samba versions take care of this on their own.

However, if you want to remove this warning, you can do so by changing your local file limits. It is always useful to distinguish local (user or session) limits and global (system wide) limits. Check you global limits with

 cat /proc/sys/fs/file-max

Chances are good that your global limits far exceed your local limits. I think the typical GNU/Linux limit is in the 100k range, I haven't looked in a really long time. You can change this value temporarely by executing

sysctl -w fs.file-max=n

or permanently by editing /etc/sysctl.conf and running sysctl -p.

To check your local limits, switch to the concerned user, e. g. samba, and run

ulimit -Hn
ulimit -Sn

This will show you hard and soft limits for the local session. The hard limit is enforced by the system, while the soft limit is enforced by the local session. You can increase the local soft limit up to the global hard limit, if necessary.

You can change the limits temporarely by running

ulimit -Hn n
ulimit -Sn m

or you can set user limits via /etc/security/limits.conf and you can even specify for which users which limits apply, e. g.

samba soft nofile 16384
samba hard nofile 32768

As always the man-pages of both files and the commands offer much more insight. Hope that helps.

bjanssen
  • 451
  • 5
  • 5
  • 2
    Ubuntu samba does not install with a samba account, it uses root. In /etc/security/limits.conf, I used * instead of samba, and it worked after reboot. – rickfoosusa May 19 '17 at 15:09
4

Limit is taken from /etc/security/limits.conf.

you show your actual limit with ulimit -n

you can change it by editing (or adding) line

*               -       nofile          16385

and reload your env param (or exit shell and enter again shell).

Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
Loris
  • 41
  • 2
1

It's simple, but i believe that so many people waste time with this question(like me haha).

We need configure the limit of parameter NOFILE in "/etc/security/limits.conf" or in another alternative file like "/etc/security/limits.d/limit-file.conf" thus:

*    -    nofile  16384

The problem is that this config do not apply to current session, we need exit and login to apply the changes, therefore our tests with TESPARM ever fails.

If you dont want restart the session, apply this command and solve this problem:

ulimit -n 16384

Hope this helps!

0

A typo in /etc/samba/smb.conf file can generate this kind of error. I followed this link and rexamined mine only to find out my problem was a typo: "yess" instead of "yes".

duenni
  • 2,939
  • 1
  • 22
  • 38
Chiadi
  • 1