0

I have seen various posts here about raising the open file limit on Linux systems for specific users (which is performed in a variety of different ways depending on the Linux distro being talked about).

I have an Ubuntu 8.04.4 LTS server running Dovecot, under a user called "dovecot";

ps aux | grep dovecot
dovecot    473  0.0  0.0  14320  2152 ?        S    12:11   0:00 imap-login
dovecot   1619  0.0  0.0  14324  2096 ?        S    Jan25   0:05 imap-login
dovecot   2652  0.0  0.0  14180  1892 ?        S    13:44   0:00 pop3-login
dovecot   3627  0.0  0.0  14180  1892 ?        S    14:13   0:00 pop3-login
dovecot   3776  0.0  0.0  14180  1892 ?        S    14:16   0:00 pop3-login
dovecot   4056  0.0  0.0  14320  2112 ?        S    14:19   0:00 imap-login
.....

ps aux | grep dovecot | wc
    178

How can I raise the open file limit for a service? Do I perform the same actions for raising the limits of use, upon the user the service runs as?

So on this system I could increase the limit in /etc/security/limits.conf for the dovecot user, but how will this relate to my service. Would I need to restart the service for the new settings to effect, or as new processes spawn will they inherit the new settings?

I can't see how changing this limit will tie in with a long running service as opposed to a user who logs in and out.

jwbensley
  • 4,202
  • 11
  • 58
  • 90

2 Answers2

2

For CentOS 7 (and I assume any other systemd-converts) you need to edit the service file. You can use this to simply override the service file so it's upgrade-safe:

systemctl edit dovecot.service

And then add:

[Service]
LimitNOFILE=4096

Change 4096 to whatever you like.

adioe3
  • 121
  • 2
1

"Do I perform the same actions for raising the limits of use, upon the user the service runs as?" - Yes. The service is running under the user's limitations, so once the limits are raised and the service restarted, it will have the new limits.

John
  • 9,070
  • 1
  • 29
  • 34