[systemd-devel] Restarting sshd

Lennart Poettering lennart at poettering.net
Mon Jan 17 14:13:22 PST 2011

On Tue, 11.01.11 14:12, Alexander E. Patrakov (patrakov at gmail.com) wrote:

> Hello.
> I have sshd-related unit files from http://0pointer.de/public/systemd-units/
> sshd.service has the following problem, which is a regression from a
> traditional SysV setup and which is not present in sshd.socket +
> sshd at .service. Yes, I know that the use of this service is
> discouraged.

I definitely encourage everybody to install sshd socket-activable and
start it on-demand instead of starting it unconditionally. That's what
MacOS does and we should too.

> The problem is that one can no longer safely restart sshd while
> connected via ssh. If one attempts to do so via "systemctl restart
> sshd.service", all ssh sessions become disconnected. Also, the
> service cannot be reloaded except by sending SIGHUP to the sunning
> sshd manually.

Make sure to enable pam_systemd properly. If so then all ssh sessions
will be removed from the ssh cgroup and be put into the the session
cgroup of the user. That's a much cleaner and safer solution. And also
much more beautiful in "systemd-cgls".


Lennart Poettering - Red Hat, Inc.

More information about the systemd-devel mailing list