2

if I ssh in to my Pi that has a tv attached to the svideo I can set tty1 writable but it does not seem to "see" the input, the characters just appear on the screen.

sudo chmod 666 /dev/tty1
echo msg1 > /dev/tty1

I understand that it is a security risk to be able to write characters to the login shell, but how can I do it?

I want to be able to see characters I send and then have them accepted as if a keyboard was attached.

Is it just a getty security "thing"? If I set up automated login would I be able to execute "ls" etc directly on tty1?

  • 1
    Couldn't you just print the command to tty1, and then run the command from ssh, and forward the output to tty1. That way the end result would be about the same. Except maybe missing the pi@raspberrypi ~ $ in front on the command, but you could just fake that by also printing that. – Gerben Oct 29 '13 at 16:10
  • @Gerben that is shear genius! Worked perfectly and so simple. Set it as an answer and I will accept it. Now I need to find a way of setting stdout to /dev/tty1, but that is a separate issue. – rob Oct 30 '13 at 8:49
  • Does somecommand > /dev/tty1 not work? – Gerben Oct 30 '13 at 15:48
  • yep that works but I would rather not add >/dev/tty1 for every command I enter, in fact what would be ideal is instead of setting stdout to /dev/tty1 is to also send anything from stdout to /dev/tty1 so I keep a copy in my ssh session as well as it appearing on the Pi's screen. – rob Oct 30 '13 at 20:28
  • 1
    @Gerben that only seems to work for scripts, but I found a simple way. bash 2>&1 | tee /dev/tty1 Creates a new shell with all the STDOUT and STDERR being copied to TTY1. The only downside is you do not see the prompt on the other screen. – rob Nov 3 '13 at 21:26
0

Couldn't you just print the command to tty1, and then run the command from ssh, and forward the output to tty1.

That way the end result would be about the same. Except maybe missing the pi@raspberrypi ~ $ in front on the command, but you could just fake that by also printing that.

1

Old thread, I know.

I had a need for this exact situation, so I wrote a program for it. Using uinput, I forward my ssh connection to the console keyboard (and soon, console mouse too!).

Effectively, it connects your keyboard directly to the RPi, as if you were typing on a USB keyboard plugged into the RPi. Certainly interesting to type on my laptop, and see the output on the bigscreen, as if I were typing on the RPi itself.

I have some plans for this utility, it's usefulness is growing as I play with it. I'm planning on forwarding the mouse events too, so really you could use keyboard & mouse on a remote computer (not just RPi!), great for demonstrations and show&tell type things.

Disclaimer: I wrote this. Good, Bad, or just plain Ugly, it's my fault.

fauxcon - fake console connection

  • could come in handy :) – Florian Fida Jul 16 '14 at 7:34
  • Very handy! I've been using it to run a text mode music player on RPi, which is displayed on my HDMI TV, rather than in my terminal window on laptop. Not shovelling tons of data across network to display app. Works with X Windows too, just need to get mouse events passed through and then my laptop/computer will act as a wireless keyboard/mouse for RPi. (or any other system!). Basically, I wanted 'run over there, display over THERE'... rather than the 'run over there, display over HERE' you usually get with ssh. (gosh! it's just a simple 'T'... that's the answer!) – lornix Jul 16 '14 at 8:06
2

I would use screen in this situation. Start a screen session, then attach to it on both the console and on the remote machine.

  • 1
    And as always, try tmux if you want to use screen. It's like the better version of screen. – Arne Oct 29 '13 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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