[systemd-devel] ssh.service in rescue.target

Mantas Mikulėnas grawity at gmail.com
Fri Nov 6 22:08:35 UTC 2020


On Fri, Nov 6, 2020, 23:31 Phillip Susi <phill at thesusis.net> wrote:

>
> Lennart Poettering writes:
>
> > Are you running systemd? If so, please get rid of "killproc". It will
> > interfere with systemd's service management.
>
> I see.. apparently Ubuntu still has it around.  How does systemd handle
> it?  For instance, if a user logged in and forked off a background
> process, how does systemd make sure it gets killed when isolating to
> rescue.target?  Does it decide that it is still connected to ssh.service
> and so won't kill it when isolating?  I'd like to make sure anything
> like that is killed and maybe restart sshd if needed.
>

No, user processes are moved to their own cgroup and unit (usually
session-XX.scope nested under user-UID.slice) as soon as sshd calls
pam_systemd during login.

(This includes also the sshd "worker" process which handles that
connection, which is the one calling PAM.)

You can see the "contents" of sshd.service in its `systemctl status`, and
you can run `systemd-cgls` to get a tree of all cgroups and which processes
they contain.

I don't exactly know in which conditions the session scopes (or the whole
user slice) are stopped. But in any case, stopping a unit should kill all
processes with no "leftovers".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20201107/f204275d/attachment.htm>


More information about the systemd-devel mailing list