When restart sshd service, KillMode sprecifys which mode the process is supposed to be killed. See https://www.freedesktop.org/software/systemd/man/systemd.kill.html By default, It will kill all process in control-group, that is, main process and its forked ones. This is not desirable in practice. Usually, developers expect his session still remains. Also investigated the other distros, KillMode=process is prefered. Reproducible: Always Steps to Reproduce: 1.ssh machineA 2.sudo systemctl restart sshd Actual Results: Current ssh session is dropped Expected Results: Expected sshd is restarted, but current ssh session remains.
Submit a CL: https://github.com/gentoo/gentoo/pull/20551
> Actual Results: > Current ssh session is dropped That should not happen, regardless of the KillMode setting in the service unit. pam_systemd should move the session to a separate scope, which will prevent the session sshd from being killed. Do you have PAM disabled? If so, I suggest you enable it for proper SSH session management.
Anyway, I guess changing the KillMode won't hurt anything. I'll merge it.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=28ae62f0ee4f0fc34987713043a036d581e4a3e8 commit 28ae62f0ee4f0fc34987713043a036d581e4a3e8 Author: Roy Yang <royyang@google.com> AuthorDate: 2021-04-26 19:50:42 +0000 Commit: Mike Gilbert <floppym@gentoo.org> CommitDate: 2021-04-26 20:22:33 +0000 net-misc/openssh: Add KillMode=process to sshd.service Closes: https://bugs.gentoo.org/785874 Closes: https://github.com/gentoo/gentoo/pull/20551 Signed-off-by: Roy Yang <royyang@google.com> Signed-off-by: Mike Gilbert <floppym@gentoo.org> net-misc/openssh/files/sshd.service | 1 + 1 file changed, 1 insertion(+)