2

Imagine the following scenario: "Client" and "Connected" both exist on a network. A third computer, "Isolated," is not on any network but exposes a console over a serial port that can be read by Connected. I sit at "Client" and I can access "Connected" from "Client" over ssh.

My goal is to get to "Isolated" as seamlessly as possible. I guess I could get a terminal on "Connected" and then use exec to talk to the console on "Isolated", but this seems rather clumsy. I'm sure many people have faced a similar scenario before, so what is the correct way to do this?

Peter Du
  • 131
  • a serial console is not OpenSSH. If the serial console is connected via a specific serial/ttyUSB port, you can use screen to access the console screen /dev/ttyUSB0 for isntance is how I use my Serial Cable to open the console connection for my switch when i'm connected with the USB Console Cable for it. There may be another serial port dev you can use for this too. – Thomas Ward Aug 04 '20 at 15:28
  • Hi @ThomasWard Thanks for your suggestion. I'm using ssh between the "Client" and the "Connected" computer. Usually, the back end of ssh opens up a shell on the local tty at "Connected." I suspect that there might be a way to ask it to open up the remote console instead, and save me from having to type screen /dev/ttyUSB0 on the "Connected" host. – Peter Du Aug 04 '20 at 15:33
  • A related question is https://unix.stackexchange.com/q/213172/5132 . – JdeBP Aug 04 '20 at 18:09

1 Answers1

3

From a comment:

I'm using ssh between the "Client" and the "Connected" computer. Usually, the back end of ssh opens up a shell on the local tty at "Connected." I suspect that there might be a way to ask it to open up the remote console instead, and save me from having to type screen /dev/ttyUSB0 on the "Connected" host.

The ssh command by default opens a shell on the remote system, but you can have it run other commands. In this case, it seems like what you want is something like:

ssh connected screen /dev/ttyUSB0

... which you could put in a script or an alias on "Client".

mattdm
  • 40,245
  • 1
    (You may need ssh -t connected screen /dev/ttyUSB0 to force a terminal; not sure offhand and it's been a long time since I've done this.) – mattdm Aug 04 '20 at 15:48