Systemd – Changing ulimit Settings

ulimit

I've found this link, showing how to change the ulimits on systemd.

/etc/systemd/system/<servicename>.d/override.conf
[Service]
LimitNOFILE=49152

I found a website suggesting to change the ulimits for systemd in these files:

/etc/systemd/system.conf
/etc/systemd/user.conf

[Manager] 
DefaultLimitNOFILE=49152
  • What's the difference between this two methods?
  • What's best practive?

Thanks for input.

Best Answer

/etc/systemd/[system|user].conf are used to define default values for service unit files.

As I suppose that you only want to change settings for a single unit file, the /etc/systemd/system/<servicename>.d/override.conf is the cleanest method, and definitively a best practice.