[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#751636: openssh-server: ssh sessions are not cleanly termined on shutdown/restart with systemd



On Fri, Oct 10, 2014 at 11:52:24AM +0200, Tom Hutter wrote:
> The solution provided under 
> https://bugzilla.redhat.com/show_bug.cgi?id=626477 suggests to killall ssh 
> sessions, when stopping sshd. I prefer to have at least one ssh session 
> open to my server when restarting ssh, if something goes wrong.

Agreed. This change would not be acceptable.

> Therefore I added a service, to solve this under the current Debian 
> Wheezy version I am running.
> 
> /etc/systemd/system/ssh-user-sessions.service:
> 
> [Unit]
> Description=Shutdown all ssh sessions before network
> After=network.target
> 
> [Service]
> TimeoutStartSec=0
> Type=oneshot
> RemainAfterExit=yes
> ExecStart=/bin/true
> ExecStop=/usr/bin/killall sshd
> 
> When starting, this service does simply nothing (/bin/true). But due to the 
> statement "After=network.target" it kills all ssh processes before shutting 
> down the network.

I had always thought that systemd would group processes together in
cgroups to be able to kill them more elegantly on shutdown. I'd like
to see that feature used instead of resorting to the old sledgehammer
method.

Greetings
Marc


-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany    |  lose things."    Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature |  How to make an American Quilt | Fax: *49 6224 1600420


Reply to: