I'm having trouble with increasing the open-files ulimit (ulimit -n) for a particular process on a Debian 6 server.

AFAIK I've done everything to change the servers hard and soft limits in this case, (ulimit -n shows 200000), but when I check the /proc/<process_id>/limits file it's still showing the old limits:

Limit                     Soft Limit           Hard Limit           Units
Max open files            1024                 4096                 files

The steps that I have already taken to permanently increase the ulimits are:

Added to /etc/profile:

# set ulimit n permanetly
ulimit -n 200000

Added to /etc/security/limits.conf:

*       soft    nofile  200000
*       hard    nofile  200000

Uncommented this lime in /etc/pam.d/su

session    required   pam_limits.so

What am I missing? Thank you!

Other (relevant?) info:

  • The process is started in a init.d script with start-stop-daemon
  • The /etc/security/limits.d/ directory is empty
  • Does stackoverflow.com/questions/14068793/… help? The /etc/pam.d/su file is looked at by su, so if nothing runs su on the way to invoking the process you're interested in, it likely won't be looked at. But the script in /etc/init.d is going to run as root, so you can run ulimit there and raise it to anything. – Mark Plotnick Jun 9 '14 at 15:42
  • Did you log out and back in (or log in again with su or over SSH)? Settings in /etc/security/limits.conf are applied when you log in, to all processes that you'll execute in that session. – Gilles Jun 9 '14 at 23:30
  • serverfault.com/a/642082/68972 : start-stop-daemon doesn't use PAM, but does simple chuid if requested, so pam_limits and limits.conf doesn't apply for the started daemon. – imz -- Ivan Zakharyaschev Dec 26 '17 at 22:26

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.