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.
Asked
Active
Viewed 7.9k times
3 Answers
21
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.

sysadmin1138
- 133,124
- 18
- 176
- 300
16
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

Yves Martin
- 879
- 3
- 8
- 21

mpapec
- 313
- 3
- 13
-
https://ma.ttias.be/increase-open-files-limit-in-mariadb-on-centos-7-with-systemd/ – mpapec Sep 07 '15 at 11:17
-
I think this solved my problem, thanks. – Hamidreza Khorammfar Dec 08 '22 at 09:22
11
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

Łukasz Muchlado
- 146
- 1
- 3