Centos – Increasing ulimit on CentOS

centosulimit

We have a CentOS box that I'm trying to increase the max number of files that a user can have open. Currently when I run ulimit -Sn I get 1024 and ulimit -Hn gives 4096. I need that number up around 6000.

In /etc/sysctl.conf I've set fs.file-max = 100000. In /etc/security/limits.conf I have the following set:

username soft nofile 6000
username hard nofile 65535

I've logged out and logged back in as username but am still not seeing my changes. What do I need to get this value changed?

All I have in /etc/security/limits.d is 90-nproc.conf. I've also ensured that ulimit is not being called in my .bash_profile or .bashrc.

When I run sysctl -p it spits out the settings I want and it shows the value for fs.file-max that I want. But when I run ulimit -Sn, I get 1048. If I try to run sysctl --system I get error: Unknown parameter "--system".

Best Answer

To force /etc/sysctl.conf to be read again run sysctl -p.

File /etc/security/limits.conf is read by login shells and you should close active sessions windows if in GUI. For remote logins, it takes effect on relog.