[systemd-devel] How to properly allow user to adjust LimitNOFILE?

Mathieu Bridon bochecha at fedoraproject.org
Tue Nov 22 18:16:03 PST 2011


On Tue, 2011-11-22 at 20:51 +0300, Peter Lemenkov wrote:
> Hello!
> I already found that I could add "LimitNOFILE=2048" to the "Service"
> section to explicitly set max number of opened files but I need
> something different. I want to allow user to specify it and set it
> only in case he specifies it.

Just to be clear, when you say "user", you mean the admin of the
machine?

> It looks like I should use something
> like "ExecStartPre=ulimit -n $ULIMIT_MAX_FILES" where ULIMIT_MAX_FILES
> is read from EnvironmentFile, but maybe there are some other
> recommended ways?

A local admin can always create the /etc/systemd/system/foobar.service
file and its content will take precedence over what is
in /lib/systemd/system/foobar.service

So local admins can already modify your LimitNOFILE setting, no need for
an EnvironmentFile scheme.


-- 
Mathieu




More information about the systemd-devel mailing list