Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

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.

share|improve this answer
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. – High6 Aug 31 '12 at 8:56
Obviously. Because it only affects your session. The default value is still 1024. – quanta Aug 31 '12 at 9:08
OK, thanks. I found this here. Seems to say the same, that the 1024 is hard-coded in the kernel. – High6 Aug 31 '12 at 9: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 El Fadil Dec 11 '15 at 17:23

I think it is best way. Looks good for me

share|improve this answer
which way ?. This could be a comment, not an answer – pylover May 28 at 17:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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