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 + s...@.service. Yes, I know that the use of this service is discouraged.

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.

So, I propose the following improved version of sshd.service, with the ability to reload the service, with safety regarding "systemctl restart sshd.service", and with protection against crashes:

[Unit]
Description=SSH Secure Shell Service
After=syslog.target

[Service]
ExecStart=/usr/sbin/sshd -D
KillMode=process
Restart=always
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

# Note that this is the service file for running a single SSH server for all
# incoming connections, suitable only for systems with a large amount of SSH
# traffic. In almost all other cases it is a better idea to use sshd.socket +
# s...@.service (i.e. the on-demand spawning version for one instance per
# connection).

--
Alexander E. Patrakov
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to