2

I need to access a remote computer (which is attached to a screen), using SSH - the problem is that the programs I start via SSH need to be shown on the remote screen (tail, htop, slurm, ...)

The remote computer has no X, just a plain text terminal.

How can I run commands on the remote computer showing up on its screen?

4

Afaik, it's not possible to write directly in SSH on the console of a remote screen.

However, it's possible to circumvent it with screen. You will just need an initial access to the PC you connect on.

  1. On the desktop PC, open a screen session with the command screen -s sessionName
  2. Then, in SSH, you can connect on this shell with the command screen -x sessionName
3

A unix system's text-mode console can usually be accessed through a TTY device. On Linux, you'd normally access /dev/console or /dev/ttyN, where "N" is a number starting with 1. This page gives a pretty comprehensive description of the TTY devices representing the Linux console.

TTY devices have owners and file permissions like any other file, and these things can restrict who can access the TTY device. For example, on my system I see:

$ ls -l /dev/console
crw-------  1 myid  staff    0,   0 Oct 27  2014 /dev/console

Right now, I own the console device, and permissions are set to 600, which means that only my account and root can write to it. It's normal for ownership of the console to belong to the account logged into the console at the moment.

Assuming you can access the relevant TTY device--because you're root, or you own the device, or the permissions are set to let you access it--then you can read or write to it like any other character device:

$ tail -f /var/log/messages > /dev/console

This command for example would run tail, writing the output to the console device.

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.