I wrote a small program that opens a bunch of files and played with open files limit on Ubuntu(as root). I was surprised to see that only user-level limits had effect on max number of files open.
I added this in /etc/security/limits.conf:
root hard nofile 30000
root soft nofile 30000
And set /proc/sys/fs/file-max to 20000 (sysctl -w fs.file-max=20000
).
I then ran my program to open 29000 files without any problems.
Why does not system-level setting have any effect in this case?
limits.conf
?