4

I need to have the ulimit value set at the boot time to all my services. I have values set in /etc/sysconfig/limits.conf but these values are not applicable during the boot time and it takes 1024 as default.

I have set the values in limits.conf, also checked whether /etc/pam.d/* contains "required pam_limits.so" entries and even /etc/security/limits.d/90-nproc.conf doesn't have default entries.

Now I found another way to include the value during the boot time, I came across /etc/sysconfig/init file. When I set the value in this file, all the services got the expected value during the boot time.

Now, I am unsure about the impact on the server and what things should be ignore configuring in this /etc/sysconfig/init file. Also is there any alternative other then this file or methods mentioned above.

3 Answers3

1

The ulimits aren't specific to services or system-wide, they are specific to individual accounts. The soft limit in /etc/security/limits.conf should be what appears as the default when you start the service; this doesn't seem to be happening in your case, so I would start looking at the dot-files for the user(s) running the service(s) in question or at the actual init script for the service(s) in question. I have a feeling your ulimit is set in one of those two places, and thus overriding the /etc/security/limits.conf values.

John
  • 9,208
  • 1
  • 32
  • 34
0

I've used that method you're talking about to set ulimit and umask for files created by the Apache user. Meaning, I've edited /etc/init.d/httpd and included a umask and ulimit -s configuration there, that solved my issue so I guess it's a good solution. It didn't have any impact except for the expected one.

Itai Ganot
  • 10,976
0

The file /etc/security/limits.conf is used by PAM, but PAM is utilized when a user is logging in. However when services are started, it's not going through PAM, so that's why limits.conf doesn't help. Services are launched by the init system and the settings for them is dependent on the system used. If you are using upstart, it can be set in /etc/sysconfig/init system-wide or in /etc/sysconfig/<servicename> per-service. In systemd world, ulimits can be set in the service files by usint Limit<type>=, I'm not sure how to do that system-wide. With OpenRC you can set rc_ulimit= per service or system-wide in /etc/rc.conf.

nert
  • 143