3

Can I SSH into my Pi and have a monitor reflect the activity?

Is there a way to force a refresh of the monitor via SSH?

My setup doesn't include a keyboard so SSH is my current option.

1
  • 1
    I've written a small program which connects your ssh connection to the console, so you can ssh into the RPi, and then control the display directly. github.com/lornix/fauxcon
    – lornix
    May 8, 2016 at 7:25

4 Answers 4

1

You can use script to do so. Script will write (or append) your terminal session into a file.

You can append it to the tty that is being displayed in your monitor.

In RaspBSD you can do:

# script -a -F /dev/ttyv0 and it works flawlessly.

I guess the default tty will change between different distributions, so you should look which one is the default in your system (it is listed under /dev/ttysomething)

The script utility makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).

1

I would suggest using screen (sudo apt-get install screen) you can open a command line on the graphical interface, then type screen and it will open a normal looking command line. Then from SSH you can screen -x which will attach the previous screen. To leave the screen, you press ctrl + a then d for disconnect.

Here is a pretty helpful page for random information: https://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/

2
  • Are you sure a screen session can be attached to two terminals simultaneously? Oct 14, 2016 at 10:39
  • 2
    Yes. That is what the -x is for. From the man (gnu.org/software/screen/manual/screen.html) ‘-x’ Attach to a session which is already attached elsewhere (multi-display mode). Screen refuses to attach from within itself. But when cascading multiple screens, loops are not detected; take care.
    – Ian M
    Oct 20, 2016 at 2:17
1

It seems that you could use usbip to forward input from your USB keyboard and mouse to another computer (usbip server) to your RPi (usbip client) over the network. That way you'll be able to use those keyboard and mouse as if they were connected to your RPi, instead of using SSH.

Another similar project is netevent, which is dedicated to sharing of input devices, as opposed to usbip which shares any USB devices (drives, webcams, etc.) There's also barrier.

There's also this SU question which lists a few alternative solutions: x2x, Synergy and evdev+netcat.

0

You could tell the syslog daemon (on Raspbian the package rsyslog is used by default) to write according log messages also to /dev/console which is the currently active text console under Linux. (This assumes that no X is running. If you have X running, there is a tool called xconsole in the package x11-apps which shows these messages in an X window.)

Additionally you might need to either disable screen blanking permanently (may damage your screen) or make the screen unblank in case of such an event.

The commands to control screen blanking are xset under X and the setterm on the Linux text consoles.

I though do not know how to trigger a command if a specific message is written to the syslog. One solution might be to also pipe these log messages into a script which checks every input line for the according messages and calls the above mentioned commands if a match is found.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.