Into the (open) source


Start a program with GUI remotely via SSH


This article was written in the 2014, there may have been some developments in the subject matter.
If in doubt please leave a comment in the bottom of the article.


I do not often have to start an application on a remote machine that requires the use of the GUI, more widely in applications to launch and "turn" in background, but it can always happen. I'm thinking for example to those who use a computer as a multimedia station (with XBMC setup is very simple) or even just to experience.

Suffice it to say that you can do, but it is necessary to direct the GUI application to a screen in particular.

First we will login tramite SSH:

~$ ssh user@<ipaddress>

Obviously replace "user" and "<ipaddress>" with the IP address of the PC to which we want to connect and the user configured in the PC.

Then we will make sure that requests are diverted to a session-specific graphics:

~$ export DISPLAY=:0

In this case (except for different operations) the first session open graphics.

And finally launch the program that includes the use of the GUI:

~ $ Firefox


In alternative, can be summed up in a single command all the steps:

~$ ssh user@<ipaddress> "DISPLAY=:0 nohup firefox"

When the program ends the SSH session, but the program will remain open.


I keep this blog as a hobby by 2009. I am passionate about graphic, technology, software Open Source. Among my articles will be easy to find music, and some personal thoughts, but I prefer the direct line of the blog mainly to technology. For more information contact me.