Run a GUI app on remote computer from SSH

10

2

I want to run a GUI application on my Ubuntu computer, but it should started by a shell script on my Debian server trought SSH.

Is this possible?

Patrick

Posted 2011-01-07T06:23:12.550

Reputation: 113

@pkaeding well if there are two interpretations, both useful, then you can answer for both. Do you know? Already somebody has commented asking re one of those interpretations " Alexander wrote " It's been a while, but maybe you still remember if you were able to start TeamViewer from ssh. I would appreciate if you could share more detail on how you did that. Thanks." <--- So, if you knew and answered for both, it might've helped him and others. – barlop – 2015-04-20T13:52:38.793

1It seems there is a little confusion over what you are trying to do. Are you trying to run a GUI program on a remote host, but have the GUI window appear on your local host? Or are you trying to run an application locally (and have the window appear locally), but have it triggered remotely? – pkaeding – 2011-01-07T06:50:06.970

Answers

4

Something like this should work:

#on your desktop 
xhost + #not secure, make sure your X isn't listening on any tcp ports.
echo 'export DISPLAY=:0; x-command-you-want &' > ~/run-command
chmod +x ~/run-command
#on your server
ssh user@desktop '~/run-command'

OneOfOne

Posted 2011-01-07T06:23:12.550

Reputation: 889

2

This works for me once I'm ssh'd in:

export DISPLAY=:0; nohup iceweasel &>/dev/null &

DanteAlighieri

Posted 2011-01-07T06:23:12.550

Reputation: 121

0

Yes, this is possible. You will just need to forward X traffic through the SSH connection. For example, connect like this:

debian-computer:$ ssh -X username@ubuntu-computer

Then, just start the application from the SSH prompt. The GUI window will appear on your debian box (which you are logged into locally). All processing will be done by the remote computer (the ubuntu one).

Note that this will only work if you have an X window server running on your local computer. This will definitely be the case if you have a desktop linux/unix installation, and you can also install X servers on Mac OS and Windows, but they are not installed by default.

pkaeding

Posted 2011-01-07T06:23:12.550

Reputation: 1 420

He wanted the server to run a GUI program on the desktop, aka the server connect to the desktop and execute the program. – OneOfOne – 2011-01-07T06:45:54.030

0

Thanks for your responses. In the mean time I've tried a couple other things and one of those things was to make a SSH connection to the Ubuntu computer and run a script on that machine.

On one of the first lines of that script I defined the EXPORT display. The player knows right now what display he should use..

Thanks again.

Patrick

Posted 2011-01-07T06:23:12.550

Reputation: 113

Hi. It's been a while, but maybe you still remember if you were able to start TeamViewer from ssh. I would appreciate if you could share more detail on how you did that. Thanks. – Alexander Chertov – 2013-11-14T06:19:29.630