With ulimit -n
you can see what the maximum number of open files can be. As superuser you can change that -per session- with the ulimit command, but an ordinary user can not do that. Therefore, you need to change the /etc/security/limits.conf file. For instance:
* soft nofile 10000
* hard nofile 10000
Meaning that the hard and soft limit are now increased to 10000. I didn’t know that this does not change the limits for the superuser. The asterisk (*) is not intended to change superuser limits. Instead, repeat both lines, changing the asterisk to the word root. You might need a reboot for that, but that’s all.
I needed this for Neo4j and was surprised to see that normal users could have more open files than the superuser. No more, I say, no more!