Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 452026

Summary: sshd should kill all sshd sessions when exiting to avoid hanging terminal sessions
Product: Gentoo Linux Reporter: Herbert Wantesh <rauchwolke>
Component: Current packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Herbert Wantesh 2013-01-14 12:51:10 UTC
sshd should kill all ssh sessions when exiting to avoid hanging terminal sessions

Reproducible: Always

Steps to Reproduce:
1.log in with ssh
2.reboot system
3.ssh connection is "dead"


Expected Results:  
when the system reboots ssh sessions should get killed

i allready found a fix for this just replace the stop function in the sshd initscript with this:

stop() {
        if [ "${RC_CMD}" = "restart" ] ; then
                checkconfig || return 1
        fi
        ebegin "Stopping ${SVCNAME}"
        if yesno $RC_REBOOT; then
#rebooting
                start-stop-daemon --stop -n "${SSHD_BINARY}" --quiet
        else
                start-stop-daemon --stop --exec "${SSHD_BINARY}" \
                        --pidfile "${SSHD_PIDFILE}" --quiet
        fi
        eend $?
}

as openrc introduced RC_REBOOT some time ago and its also used in the kexec init script it should be fine to use it here too
Comment 1 jannis 2013-01-14 13:04:48 UTC
have fun doing an "/etc/init.d/sshd restart" then ... Did you try to discuss this with the OpenSSH-devs (upstream)?
Comment 2 Lars Wendler (Polynomial-C) (RETIRED) gentoo-dev 2013-01-14 13:05:29 UTC

*** This bug has been marked as a duplicate of bug 367553 ***
Comment 3 Herbert Wantesh 2013-01-17 09:34:55 UTC
you are right, but why should i discuss upstream? isn't this distro related? debian/ubuntu handles this case and shuts down all ssh connections when the pc reboots