0

I have a local machine nostromo running an interactive cinnamon desktop on debian testing. On it, I have gnome-terminal running with an ssh terminal open to a remote machine sulaco. I would like to run a command in the ssh terminal such that it behaves as if I ran it from a local terminal. For example:

mooseboys@nostromo:~$ ssh sulaco
mooseboys@sulaco:~$ run-on-ssh-origin xeyes

Given the above code, I'm looking for something like run-on-ssh-origin that ends up running xeyes in my local existing desktop environment, i.e. as if I had run it in another local gnome-terminal.

The only solution I'm aware of would be to run another ssh command back to nostromo from the sulaco ssh terminal:

mooseboys@sulaco:~$ ssh nostromo xeyes

This works for non-GUI commands, but for an X application it doesn't seem to create the window on the existing interactive desktop. I'm sure there's a way to enumerate desktops and inject a command to run there, but I'm looking for something simpler and more robust. Ideally, something like run-on-ssh-origin exists, but absent that, is there a way to specify e.g. that GUI applications run over SSH should use existing interactive desktops (if present)?

1
  • Alternative: Run screen or tmux on the nostromo gnome-terminal before you login into sulaco. Create two screens, one to login into suloca, one stays on nostromo. Switch to the nostromo screen to start local applications.
    – dirkt
    Commented May 14, 2019 at 6:51

1 Answer 1

1

The reason non-GUI commands run is because you are running them in a terminal chain (nostromo->sulaco->nostromo).

For X11 applications to work in that way, you just need to enable X11 forwarding on all your client and servers. Nostromo is a server here. You would then effectively be forwarding the X11 output from server2 to server1 to client which while technically possible is a bit of a drag on performance and a bit of a waste in this exact configuration

You can however simply change the display environmental variable from within the ssh command:

ssh nostromo 'DISPLAY=:0; xeyes'

This will redirect the X11 output to the local display :0, which you may or may not own and have permission to draw on. This can also have a direct impact on what kind of commands you can send based on your quotation mark requirements.

You need to know your client's local DISPLAY number. For single user this will usually be :0. But it can be different.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .