# ulimit -n 1048576
# ulimit -n 2000000
bash: ulimit: open files: cannot modify limit: Operation not permitted
# sysctl fs.nr_open
fs.nr_open = 1048576
# sysctl fs.nr_open=2000000
fs.nr_open = 2000000
# ulimit -n 2000000
# ulimit -n
2000000
proc(5) man page:
> `/proc/sys/fs/nr_open`
> This file imposes a ceiling on the value to which the `RLIMIT_NOFILE` resource limit can be raised (see getrlimit(2)). This ceiling is enforced for both unprivileged and privileged process. The default value in this file is 1048576.
On the other hand, `file-max` is the limit for all process:
> `/proc/sys/fs/file-max`
> This file defines a system-wide limit on the number of open files for all processes. System calls that fail when encountering this limit fail with the error ENFILE.
Not that I have absolutely any idea if sufficiently large numbers of open files cause other problems.