6

Using RHEL7 with systemd

Do you have to use a specific file name convention in /etc/security/limits.d (besides the file ending in .conf)? There is a file in this directory called 20-nproc.conf. So if I wanted to raise the open file limit for USER1 how would I name this .conf file? Does that first number matter? ie. 20 in the .conf file 20-nproc.conf

And should I create this .conf in /etc/security/limits.d directory since /etc/security/limits.conf states:

Also note that configuration files in /etc/security/limits.d directory,
which are read in alphabetical order, override the settings in this
file in case the domain is the same or more specific.
...

Can I create a .conf file called 30-USER1-nofile.conf

which contains

USER1   soft   nofile   6000
USER1   hard   nofile   6000
  • this sounds like a RHEL specific thing? I use SUSE/SLES and for that it's just /etc/security/limits.conf where you could just do USER1 hard nofile 6000 per the comment section detailing the format in the beginning of the limits.conf file. – ron May 17 '17 at 15:39
  • Are you using systemd? I was just reading that for systems using systemd you have to specify the open file limit in the service unit file. – jes516 May 17 '17 at 16:21
2

The conf files in the directory are ascibetically sorted, and each sourced in order.

The numbering is a convention to ensure that all sorting methods agree, and to make inserting new rules easy when it comes to placement.

Do not, do not, edit the limits.conf file, as this is now error-attracting as it is just a bad policy in general (the reasons for which weren't as obvious back then).

  • 1
    i was able to change the open file limit starting the process with systemd using LimitNOFILE=10000 in the [Service] section – jes516 Jul 19 '17 at 20:34
  • That's a fine solution, if a little non-portable. As long as you're on a system inflicted with systemd, and the systemd folks don't change it, you should be okay. – user2066657 Jul 21 '17 at 22:32
  • Is it [Manager] or [Service] section? It seems to be Manager on CentOS Linux release 7.5 – Neil McGill Apr 4 at 20:15

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.