5

Manually I can set via ulimit -n 20000 the file descriptor limit and it works fine. To have this limit for every user also after a restart of the machine, can I add

*                soft    nofile          20000

to /etc/security/limits.conf?

I can't try because I can't really restart the server.

Bill the Lizard
  • 352
  • 1
  • 7
  • 15
disco crazy
  • 277
  • 6
  • 14

1 Answers1

5

Yes. This is one of the correct ways. Another way is setting fs.file-max in /etc/sysctl.conf.

But wait, no need to restart your server to checking, run ulimit -n 20001 from the command line, logout and login back, then re-run ulimit -n to see what happens.

quanta
  • 51,413
  • 19
  • 159
  • 217
  • OK, that's weird. I set via ulimit -n 20000 and then it has been set. If i logout and login again it returns me 1024. the old value. – disco crazy Aug 31 '12 at 08:56
  • Obviously. Because it only affects your session. The default value is still 1024. – quanta Aug 31 '12 at 09:08
  • 1
    OK, thanks. I found this here. Seems to say the same, that the 1024 is hard-coded in the kernel. http://superuser.com/a/325323/87348 – disco crazy Aug 31 '12 at 09:22
  • N.B. in some situations it is also necessary to set the hard limit, with an extra lines inside the limits file: `* hard nofile 20000` – Mehdi Dec 11 '15 at 17:23