Hey guys!
Got a question! Is there an way to set open file(nofile) to unlimited permanently? If so, is it recommended?
I was only able to set the max number of processes(nproc) value to unlimited in the /etc/security/limits.conf configuration file, but I couldn't set the same value to open file(nofile).
username hard nofile 1024000
username soft nofile 512000
username hard nproc unlimited
username soft nproc unlimited
Thanks in advance.
You need to restart the user session to load the new values. Also, the recomendation is to use the drop in folder /etc/security/limits.d instead of modifying the limits.conf directly.
You need to restart the user session to load the new values. Also, the recomendation is to use the drop in folder /etc/security/limits.d instead of modifying the limits.conf directly.
Is there an way to set open file(nofile) to unlimited permanently? If so, is it recommended?
Hey, @jrios!
From the limits.conf(5) manual:
All items support the values -1, unlimited or infinity indicating no
limit, except for priority and nice.
However, session limits set for number of open files by pam_limits.so can never override the /proc/sys/fs/file-max kernel setting which is calculated dynamically, based on the estimated system capacity.
Theoretically, you are on the safe side even if you set your hard limit to -1, but it wouldn't hurt to make it a fraction of what file-max is set to, depending on how many concurrent users you need to support.
(Useless trivia: on a 4-core, SMT, 32GB RAM, x86_64 RHEL7 workstation system running kernel version 3.10.0, file-max is 3233400.)
Cheers,
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.