I think man ssh
says it all:
-e escape_char
Sets the escape character for sessions with a pty (default: ‘~’).
The escape character is only recognized at the beginning of a
line. 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. Setting the
character to “none” disables any escapes and makes the session
fully transparent.
You need to send ~~.
Alternatively you could change the escape character for every ssh hop you take with ssh -e escape_char
.
You can also specify it as a runtime option; e.g. -o EscapeChar=:
Thus you may also add it to your client config file ${HOME}/.ssh/config
.