Unix & Linux: How can I increase open files limit for all processes? (5 Solutions!!)
Channel: Roel Van de Paar
Date: 10/08/2020

Unix & Linux: How can I increase open files limit for all processes?


The Question: I can use ulimit but I think that only affects my shell session. I want the
limit increased for all processes. This is on Red Hat.

Solutions: Please watch the whole video to see all solutions, in order of how many people found them helpful

== This solution helped 14 people ==
According to the article http://www.cyberciti.biz/faq/linux-increase-the-
maximum-number-of-open-files/, you can increase the open files limit by adding
an entry to /etc/sysctl.conf.
Append a config directive as follows:
fs.file-max = 100000
Then save and close the file. Users need to log out and log back in again to
changes take effect or they can just type the following command:
# sysctl -p
You can also verify your settings with the command:
# cat /proc/sys/fs/file-max

== This solution helped 27 people ==
Justin's answer tells you how to raise the number of open files available total
to the whole system. But I think you're asking how to raise the per-user limit,
globally. The answer to that is to add the following lines to /etc/security/
limits.conf:
* soft nofile 2048
* hard nofile 2048
(Where the * means all users.)
There's some summary documentation in that file itself and in man limits.conf.
This is implemented via the pam_limits.so module which is called for various
services configured in /etc/pam.d/.
And, I have to admit, I have no idea where that 1024 default comes from. And
believe me, I looked. I even tried without the pam_limits module configured,
and it's still there. It must be hard-coded in somewhere, but I'm not exactly
sure where.

== This solution helped 14 people ==
Increase max number of ulimit open file in Linux
1.Step : open the sysctl.conf and add this line fs.file-max = 65536
$ vi /etc/sysctl.conf
add new line and
fs.file-max = 65536
save and exit.
2.Step:
$ vi /etc/security/limits.conf
and add below the mentioned
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
save and exit check max open file ulimit
# ulimit -a

....
open files (-n) 65535

== This solution helped 3 people ==
SUPLEMENT:
You may find config in different place: /etc/security/limits.d/*.conf
I had to modify it. It didn't work without it. Format is the same as for
limits.conf

With thanks & praise to God, and with thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free-music | Images: https://stocksnap.io/license & others | With thanks to the Stack Exchange Network (http://unix.stackexchange.com/questions/8945). Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything is amiss at Roel D.OT VandePaar A.T gmail.com.