vi /etc/security/limits.conf

add following lines

* 	 soft     nproc          65535
* 	 hard     nproc          65535
* 	 soft     nofile         65535
* 	 hard     nofile         65535
root 	 soft     nproc          200000
root 	 hard     nproc          200000
root 	 soft     nofile         200000
root 	 hard     nofile         200000

vi /etc/sysctl.conf

add this line:

fs.file-max = 2097152


sysctl -p


Note For Docker:

if you want to execute ulimit inside unprivileged docker container you will get:

ulimit: open files: cannot modify limit: Operation not permitted

For resolving this execute below commands on docker HOST:

ulimit -l unlimited
ulimit -n 2097152 
ulimit -c unlimited

Then Restart Docker Service. The Problem Solved

Note: Increase Open Files Limit Per Process

current limit:

cat /proc/<pid>/limits | grep files

change limit:

prlimit -n65535 -p pid_of_process

By: Mehdi Sadighian
TAG: slackware, open files descriptors