8

It seems like a very easy question but I couldn't find, what the default for services in SystemD for LimitNOFILE is.

Is there a file with global defaults?

Martin Rauscher
  • 1,700
  • 1
  • 14
  • 20

3 Answers3

6
#/etc/security/limits.conf
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
#if your program startup via systemctl
#config /etc/systemd/system.conf
DefaultLimitNOFILE=
hello-world
  • 61
  • 1
  • 1
3

systemd imposes no such limit by default. however pam_limits generally does, configuration file is /etc/security/limits.conf

  • Thanks! So one could say that SystemD just overrides the ordinary Linux limits? – Martin Rauscher Dec 19 '15 at 08:09
  • Systemd is able to raise or decrease the system defaults, please see http://serverfault.com/questions/356962/where-are-the-default-ulimit-values-set-linux-centos top comment for a longer more detailed explanation – Cristian Rodriguez Dec 19 '15 at 16:17
  • For us, systemd did impose this limit (ubuntu 18.04 and 20.04). We had all of our servers crash and changing `LimitNOFILE` to a high value did fix the problem. Limits in `/etc/security/limits.conf` were set high enough and increasing it alone did not fix the problem. Maybe it has been changed since 2015. – Leifb May 16 '22 at 07:56
  • 1
    it appears `/etc/systemd/system.conf` now does apply a limit (see the other answer) – Radek Liska Jan 18 '23 at 16:14
2

The default config is in /etc/systemd/system.conf, and the default value is DefaultLimitNOFILE=1024:524288.

KeithTt
  • 71
  • 1
  • 7