
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 4,902 Views
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.
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 4,894 Views
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.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 4,895 Views
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 4,851 Views
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,
[don't forget to kudo a helpful post or mark it as a solution!]