Re:SSH tips and tricks
by GekkePrutser on Wednesday August 17, 2022 @12:09AM
(#32492226)
And if you're deeper in nested SSH sessions you can use a number of ~s to indicate which one to kill.
There's more commands than the dot too but I admit I forgot the others
Re:SSH tips and tricks
by francislavoie on Wednesday August 17, 2022 @02:47AM
(#32493092)
Ahhh that would explain why it didn't feel consistent for me, since I use ProxyCommand to hop through another box most of the time. I usually need to do that key sequence twice. But I guess now I know I just need the tilde twice.
I think the ProxyJump config option will help you.
ProxyJump (or the -J option as a shortcut) plus TCP port forwarding (-L/-R) is ridiculously powerful. You can chain jump hosts with commas, threading a port forward deep into (or out of) multiple server hops with a single command.
To be more precise ~ is the default ssh escape character. It is only treated as the ssh escape character if it is at the beginning of a new line. From the ssh(1):
> The escape character followed by a dot (`.') closes the connection; followed by control-Z suspends the connection; and followed by itself sends the escape character once.