Das Terminal zu schliessen oder den Prozess zu töten kann natürlich keine Lösung sein, zumal die Entwickler dieser Clients bereits an dieses Problem gedacht haben. Sowohl für SSH als auch für Telnet existiert ein so genannter Escape Character, um aus der Session zu entkommen und Zugriff auf das Programm zu erhalten.
Dieses Zeichen ist für SSH in der Voreinstellung die Tilde (~). Auf einer deutschen Tastatur ist sie über AltGr+ zu erreichen. Natürlich kann auch ein anderes Zeichen definiert werden. Die SSH Manpage sagt dazu:
-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.
Folgende Befehle sind dann laut Manpage möglich
The supported escapes (assuming the default `~') are:
~. Disconnect.
~^Z Background ssh.
~# List forwarded connections.
~& Background ssh at logout when waiting for forwarded connection / X11 ses-
sions to terminate.
~? Display a list of escape characters.
~B Send a BREAK to the remote system (only useful for SSH protocol version 2
and if the peer supports it).
~C Open command line. Currently this allows the addition of port forward-
ings using the -L and -R options (see above). It also allows the cancel-
lation of existing remote port-forwardings using -KR hostport. !command
allows the user to execute a local command if the PermitLocalCommand
option is enabled in ssh_config(5). Basic help is available, using the
-h option.
~R Request rekeying of the connection (only useful for SSH protocol version
2 and if the peer supports it).
Ein Zirkumflex (^) steht übrigens für die Taste Ctrl (Strg). Funktionieren diese Kombinationen nicht, so ist auf dem Client PC vielleicht deadkeys als Tastaturlayoutvariante eingestellt. In diesem Fall muss die Tilde zwei mal gedrückt werden um diese Kommandos ausführen zu können. Soll die Tilde auf der Shell der Gegenseite ankommen ist sogar ein viermaliger Druck notwendig.
Telnet zeigt das Escape Zeichen beim Verbindungsauf an:
$ telnet www.google.de 80
Trying 72.14.221.104...
Connected to www.google.de.
Escape character is '^]'.
Dieses eckige Klammer (]) ist auf Tastaturen mit englischem Layout leicht zu erreichen und es muss tatsächlich nur Ctrl (Strg) und die ]-Taste gedrückt werden. Beim deutschen Layout wird zusätzlich noch AltGr gebraucht, wodurch die Kombination fast schon zum Affengriff wird. Dort muss Strg+AltGr+9 gedrückt werden, damit man in den Kommandomodus von telnet wechselt. Natürlich lässt sich auch dieses Zeichen ändern:
-e escapechar
Sets the initial telnet escape character to escapechar. If escapechar is
omitted, then there will be no escape character.
Mit einem einfachen Druck auf Return wechselt telnet vom Prompt zurück in die Verbindung.


Kommentare