2025-02-28 21:16:00
I was today-years-old when I realized something about SSH that I hadn't realized before.
A student of mine was using SSH to connect between two Linux hosts and he wondered if it's possible to temporarily pause or interrupt the SSH session, so he can run a few commands on the source / originating host.
I thought, surely there must be! And there is! I just never realized before. :)
Way way way back, twenty years ago, we used Cyclades terminal servers at ${Customer}. Nifty rackmounted boxes that hook up to the network and provide SSH access to 24 or more serial ports.
I remembered from back then that SSH had a command to immediately kill an SSH connection: ~.
The tilde being the stop / escape character for SSH and the dot being the kill command. You could also quickly type ~? in an SSH session to pull up a menu.
To answer my student's question, I hopped into my Fedora box from Windows with SSH and then did another SSH to Ubuntu. That's one SSH after connecting using another.
You can stack multiple tildes to indicate which SSH client you're talking to. Typing ~. kills the Windows to Fedora connection, while ~~. kills the Fedora to Ubuntu connection.
Looking at the ~? menu I noticed a few neat options, including ~^Z.
In Unix terminals, ^Z (ctrl Z) is used to send a suspend / SIGSTOP to your running process. So indeed, the following happened:
tess@ubuntu $ hostname
ubuntu
tess@ubuntu $ ~^Z
bash: suspended ssh
tess@fedora $ hostname
fedora
tess@fedora $ fg
tess@ubuntu
It works! :D
kilala.nl tags: work, mentor, studies,
View or add comments (curr. 0)
All content, with exception of "borrowed" blogpost images, or unless otherwise indicated, is copyright of Tess Sluijter. The character Kilala the cat-demon is copyright of Rumiko Takahashi and used here without permission.