How to get /etc/security/limits.conf changes reflected for processes running under headless user?

15,937

I had the same problem (with root/myuser) and was unable to find a definitive answer. I ended up just adding

ulimit -n 64000

To the init.d script that launches the process (Elastic search in this case), and this seems to do the trick.

Hopefully someone else knows a better solution!

Share:
15,937
Ameliorator
Author by

Ameliorator

Updated on June 18, 2022

Comments

  • Ameliorator
    Ameliorator almost 2 years

    To increase the FD limit for all processes on a Ubuntu Linux machine we did following changes in /etc/security/limits.conf

     soft nofile 10000
     hard nofile 10000
    

    We also added session required pam_limits.so in /etc/pam.d/login. The changes got reflected for all the users who logged out and logged in again. Whatever new processes are starting under those users are getting new FD limits.

    But for the processes which are running under headless user the changes are not getting reflected. what is the way by which the changes can be reflected for the processes which are running under headless user as well ?

  • Ameliorator
    Ameliorator over 11 years
    you must be launching the init.d script using sudo rights because of which ulimit -n might be working. In my case the script which launches the process is not run under root privileges so using ulimit which requires root privileges is not an option here
  • Mike Wade
    Mike Wade over 11 years
    Yes that is correct. I do not understand why the /etc/security/limits.conf seem not to apply to the init.d script. (I can launch it manually after the fact and the limits are as expected!)
  • Jeff Maass
    Jeff Maass about 9 years
    In my particular case, the application which I was running was begun with sudo. I believed that the limits would therefore be applied from the root user's account. I was wrong. Instead, I found that, although the application was running as root, the limits applied to it were the limits belonging to the user which launched the application.