I am searching for a way to interact with a local console via SSH – just as you would do with an directly connected keyboard.
In my particular case I got a debian server (console only, no X system) which displays several textual values on tty1. There are not input devices attached to this computer, just a single display. The configuration is done over ssh. Commands executed in SSH should show up on tty1.
Is there a way to interact with tty1 in the same manner as a VNC session would do on a X-Window system?
Best Answer
You can read the text currently displayed on the screen from
/dev/vcs
. If your terminal window has the same number of columns as the actual screen output on the server, then you can simply typecat /dev/vcs
and get a recognizable output.You can append a number to access a specific console rather than always the active console. And you can use
vcsa
, if you want formatting information as well. So for example you can use/dev/vcsa1
to get the text on the first VC a long with formatting information.Producing keyboard input is another matter. AFAIR the calls used by
gpm
only supports cut-n-paste, and doesn't allow arbitrary keystrokes to be input. A few searches on the net suggested it isn't supported out of the box, but it is possible to implement as a driver.