On Sun, 7 Feb 2016 14:36:24 +0100 "Alexander Afonyashin"
<f...@iname.com> wrote:
> 1. Remove symlink /etc/systemd/system/sshd.service -> 
> /lib/systemd/system/ssh.service - who knows what does symlink do here?
> 2. Copy /lib/systemd/system/ssh.service to /etc/systemd/system/ssh.service.

Forking the whole file can by avoided by overriding just the desired
part. In that case, using "systemctl edit ssh" or running those as root
would have been enough:

mkdir -p /etc/systemd/system/ssh.service.d/
cat << EOF >> /etc/systemd/system/ssh.service.d/override.conf
[Service]
ExecStop=/usr/bin/pkill sshd
EOF
systemctl daemon-reload

> 3. Edit /etc/systemd/system/ssh.service, add ExecStop=/usr/bin/killall sshd 
> to [Service] section:

Unfortunately, killing every sshd instances is dangerous. Anyone
stopping the service remotely would be locked out.

I think that another service would be needed to cleanup SSH sessions on
shutdown before they are forcibly killed.

Regards,
Simon

Reply via email to