Initiate a ControlMaster session: ssh -M foo In a new terminal, start a new session that uses the ControlMaster connection: ssh foo Terminate the second by using the standard sequence "\n~.", the client will hang. It will still respond to signals, but cannot be terminated from its terminal. Eg. hitting ^C or ^Z has no effect (which, I recon, is not that surprizing as they don't affect the client process either while the connection is still active; they just get sent to the remote shell- that makes loosing the terminal no less annoying, though). The only way to escape this situation and regain control over the controlling terminal is by opening another and signaling the ssh client or terminating the ControlMaster connection.
Created attachment 1839 [details] send-close-on-mux-session-close.diff Unblock sending of SSH2_MSG_CHANNEL_CLOSE on mux sessions
I think this patch should fix it, but I need to test a few corner cases.
patch applied, this will be in OpenSSH-5.6. Thanks for the report.
Move resolved bugs to CLOSED after 5.7 release