<div dir="ltr"><div><div><div><div><div><div>Lennart,<br><br></div>Your explanation sounds great but it's just not what I'm seeing.<br><br></div>My user@.service has "PAMName=systemd-user" in the [Service] section.<br><br></div>I have setup limits for the user in /etc/security/limits.d/foo.<wbr>conf.<br><br></div>I have no other limit overrides in any other systemd file.<br><br></div>Whether I reboot or "systemctl restart user@<uid>" I see the same thing. That is, the limits set through pam_limits are not respected.<br><br></div>I consistently see that if I login as that user, then "ulimit -a" shows the values I expect from pam_limits while "cat /proc/<pid>/limits" for the user instance process or its children do not.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 20, 2017 at 8:47 AM, Lennart Poettering <span dir="ltr"><<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Mo, 20.11.17 08:32, Jeff Solomon (<a href="mailto:jsolomon8080@gmail.com">jsolomon8080@gmail.com</a>) wrote:<br>
<br>
> I am using lingering and I have issued "systemctl restart user@<uid>" and<br>
> then seen the instance restart with a new PID. So I think I am restarting<br>
> the user instance.<br>
><br>
> When Limit* directives are applied in "user@.service" or in<br>
> "/etc/systemd/system/user@.<wbr>service.d/whatever.conf" I see that they are<br>
> respected in the user instance itself and the child processes it starts.<br>
><br>
> However, I do NOT see settings applied through pam_limits<br>
> (/etc/security/limits.d etc etc) respected in the user instance although<br>
> Mantas implied that I should. Is this expected?<br>
<br>
</span>When systemd executes a service that has PAM enabled, it will will<br>
first start the PAM session, which is where pam_limits does its<br>
thing. It then goes on setting up the execution environment for the<br>
service, and if resource limits are configured for the unit, they'll<br>
be put into effect. This means that any settings configured in the<br>
unit file they take precedence over the pam_limits settings.<br>
<div class="HOEnZb"><div class="h5"><br>
Lennart<br>
<br>
--<br>
Lennart Poettering, Red Hat<br>
</div></div></blockquote></div><br></div>