Setting the max number of file descriptors open limit

To check kernel set open files limit
% cat /proc/sys/fs/file-max
8192
To increase kernel set to 65535 (as root)
# echo “65535” > /proc/sys/fs/file-max
If you want this new value to survive across reboots add it to /etc/sysctl.conf
fs.file-max = 65535
You can load these values live from the sysctl.conf file.
# sysctl -p /etc/sysctl.conf
The previous settings will only be for root, we need to adjust some files for all
the users to have them inherited.
To increase this to 65535 for all users (as root)
add two lines to /etc/security/limits.conf
kraftek.html POSTS rescue rescued.html rescued.txt x y z soft nofile 65535
kraftek.html POSTS rescue rescued.html rescued.txt x y z hard nofile 65535
Now add the next entry to /etc/pam.d/login
session required /lib/security/pam_limits.so
Relogin as your non-root user and check the new file open limit with:
$ ulimit -n
154/433

Leave a Reply

Your email address will not be published. Required fields are marked *