Bug 2781

Summary: ssh tunnel doesn't close after logout
Product: Portable OpenSSH Reporter: jg
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED INVALID    
Severity: enhancement CC: djm, dtucker
Priority: P5    
Version: 7.2p2   
Hardware: Other   
OS: Linux   

Description jg 2017-09-18 20:32:10 AEST
I noticed that an SSH tunnel won't close until I exit Chrome Browser that was using the tunnel. Shouldn't ssh force close of the connection?


$ ssh -i "jonny3.pem" -C -D localhost:8080 ubuntu@mypc
Last login: Mon Sep 18 07:25:43 2017 from xx.xx.xx.xx
ubuntu@mypc:~$



From my desktop:
$ /usr/bin/google-chrome --user-data-dir="$HOME/chrome-with-proxy" --proxy-server="socks5://localhost:8080"


Try to terminate the ssh connection, and it won't

ubuntu@mypc:~$ logout

<wait 10 seconds>

<close Chrome>

Connection to x.x.x.x closed.
Comment 1 Darren Tucker 2017-09-18 21:34:04 AEST
(In reply to jg from comment #0)
> I noticed that an SSH tunnel won't close until I exit Chrome Browser
> that was using the tunnel. Shouldn't ssh force close of the
> connection?

No.  In SSH2 the connection and the login are distinct things.

> Try to terminate the ssh connection, and it won't
> ubuntu@mypc:~$ logout

No, you're terminating the interactive shell's channel, which is one of possibly many channels within the connection.  If you really want to kill the connection regardless of how many channels are open then use the ~. escape sequence.
Comment 2 Damien Miller 2017-11-03 13:32:48 AEDT
As Darren mentioned, this is by design.
Comment 3 Damien Miller 2021-04-23 15:00:25 AEST
closing resolved bugs as of 8.6p1 release