Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Sometimes I need to start XMBC media player or other GUI software a one of my PC (small Xubuntu PC used as a media center).

Usually I do this starting a X11vnc server on the remote PC via SSH and than connecting with an Xvnc client to the Xfce desktop.

Is there a way to start a GUI software on a remote Linux PC via SSH?

Thanks!

share|improve this question

3 Answers 3

up vote 25 down vote accepted

Yes. You just need to run export DISPLAY=:0 (or whatever the remote display is numbered as) in your ssh session and programs run will run on the remote display. A quick example:

oli@bert:~$ ssh tim
oli@tim:~$ export DISPLAY=:0
oli@tim:~$ firefox

Firefox is now running on tim's display.

However when you close your ssh session, most of the time the remote application will close. If you want to disconnect from ssh but leave the application running you need to launch it in a special way using something like screen (keeps the ssh session running in the background) or nohup, or another method. For more information on this there was recently another question on it.

You can shorten this all down into one command that will connect, export the display in-line and start the application in a way that won't close it after the ssh session dies:

ssh tim "DISPLAY=:0 nohup firefox"
share|improve this answer

With the vnc-viewer from tightvncviewer Install tightvncviewer you can connect to a remote via an SSH connection by using option -via

vncviewer -via user@remote localhost:0

Choose your display at localhost:<display<> according to your local settings.

share|improve this answer

I run scripts on a remote machine using ssh this way:

$ ssh u@r 'perl path/to/script.pl'

where "u" is the remote machine user and "r" is the remote machine hostname.

share|improve this answer
1  
What has that to do with "starting a GUI"? –  guntbert Jun 25 at 20:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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