How can I permanently set ulimit -n 8192 in Centos 7?

74,260

Solution 1

Unless they've done something really wacky (if so, blame systemd) that's all set in /etc/security/limits.conf.

*    soft    nofile 8192
*    hard    nofile 8192

Something like that.

Solution 2

If you want to increase file limit for system service you'll have to edit /usr/lib/systemd/system/SOME_SERVICE.service

add LimitNOFILE,

[Service]
...
LimitNOFILE=8192

and run systemctl daemon-reload to activate changes.

Please refer to systemd execution Limit directives documentation

Solution 3

It could be done by creating new config file in: /etc/security/limits.d/ (to be on safe side when upgrading etc). For example:

/etc/security/limits.d/nofile.conf

with content as written before by sysadmin1138:

*    soft    nofile 8192
*    hard    nofile 8192
Share:
74,260

Related videos on Youtube

surfingpig
Author by

surfingpig

Been programming games for awhile now. Graduated from Digipen in 2004 with a Bachelors.

Updated on September 18, 2022

Comments

  • surfingpig
    surfingpig almost 2 years

    I would like to permanently set the open file limit for all users in Centos 7, but there seems to be a lot of conflicting information out there on the googles.