I edited /etc/security/limits.conf to have

root hard nofile 20000
root soft nofile 10000

And added

session required pam_limits.so

to /etc/pam.d/common-session and /etc/pam.d/common-session-noninteractive.

After reboot and relogin ulimit -n still shows 1024.

If I do su and try ulimit -n again then it shows 10000. But after a relogin it goes back to 1024.


Check the manual: man limits.conf

That will show you that the first field in that configuration file is the <domain> or simplified: the users or groups for whom the setting is applied to. So when you use root there it's completely expected that it only works for root and not for any other user.

Try the following to apply it to all users or better find some middle ground and apply to the correct users/groups.

*     hard      nofile     20000
  • Hey there, my goal was to increase it for the root user, I login as root and ulimit -n shows 1024, if I do su and then ulimit -n it shows 10000. – Barış Uşaklı Dec 13 '14 at 19:06

For RHEL and related distributions, there is now a new directory /etc/security/limits.d

The files within this directory silently override the information in the /etc/security/limits.conf file(!).

Check for 90-nproc.conf and you'll see the culprit there.

You can create new files in this directory - they are read in numeric order, so for application specific values create a file named something like 95-appname.conf and put the values required in there.

Note that any new files must have the extension '.conf' or the system will ignore them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.