I have open tunnel with
ssh -2 -N -L 5001:localhost:1019 firstname.lastname@example.org
The tunnel is working good, but I have to Ctrl+C or Ctrl+D to force quit the tunnel. How can I close the tunnel gracefully?
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
SSH has a escape sequence to reset the connection, it will probably work for what you want. Press enter, then
~., yes it's enter tilde-dot.
It also works when you have a hanged SSH connection (like a connection that timed out but didn't close), just press enter (I have an habit to press it more than once) and the tilde-dot sequence to close it.
Some useful ones:
~?will show you all the escape sequences available
~^Zthat's control+Z will suspend your SSH session (you can get it back with