3

I want to get output/input from /dev/ttyX console (normally accessible directly using keys ctrl+alt+FNr, where Nr is number of /dev/ttyNr: ctrl+alt+f4 access /dev/tty4). I want to view and control these consoles over ssh (which normally uses virtual /dev/pts console like desktop applications (xterm) does). I need something to either connect from normal virtual terminal (/dev/pts/Y) to /dev/ttyX, or switch consoles.

For physical devices like /dev/ttySX, /dev/ttyUSBX utilities like minicom and screen after setting baud rate are working well. I tried to apply similar methods for virtual /dev/ttyX but sessions only hang: output send from screen gets to tty, but are not executed and input does show (ctrl+alt+f4 shows output but it does not get executed, neither while writing anything shows up in screen: like I would be using echo nonsense >> /dev/tty4 but not having real session). minicom does the same. Either I am abusing utilities or I don't know how to properly setup tty's.

Should I do something with getty? It seems that it is important here too.

Any ideas how to connect to /dev/tty from pts console? I am using Linux with systemd if that is important.

2

Why? :) The /dev/ttyX terminals are just software terminals provided by the kernel. The /dev/pts/* terminals are essentially pipes connected to /dev/ptmx, and according to man pts on my closest-available RHEL6 system, the interface is identical between the two. If you're implementing a program to replace a terminal interface, using /dev/ptmx is the generally "right" way to do it anyway. On a Linux system, the filename is all that really differs. You could probably just create a symlink named like /dev/ttyX after creating the pty if the filename is really that important.

If your goal is to remotely control the screen attained when you hit Alt+F4, for example, just change /etc/iniitab to open your alternate "remote control" program on /dev/tty4. Normally it starts up a mingetty, but there's no reason you couldn't run whatever you want there. You may also look at the mingetty man page to see what else you can do with mingetty; it's capable of several interesting things.

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.