Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any way to remotely (ie, via SSH) launch a graphical program on a Linux machine? When using Putty, if I execute a command requiring X, I get "failed to open display". Note that I want the program to launch on the remote machine - so I do NOT want to forward the output to a local X server or anything like that.

I want this specifically for creating a remote-control app on Android - ie I hit a button on my phone, it opens a picture slideshow on the Linux machine.

I'm starting to feel like I may need to write my own server process to listen for these events...but if I can push them via SSH it might be simpler.

share|improve this question

migrated from Aug 17 '11 at 18:17

This question came from our site for professional and enthusiast programmers.

up vote 6 down vote accepted

You have to set DISPLAY environment variable to X server you want your program to connect to.

For example xterm could be started with: DISPLAY=:0 xterm

share|improve this answer
Thanks! I had tried DISPLAY=0 with no luck. DISPLAY=:0 did the trick. – Andrew Aug 17 '11 at 15:22
ssh -n remotehost env DISPLAY=:0 <command> &
share|improve this answer

You need to have a X Server to receive windows from a remote Linux Application. So you must port something like X11 to android. I think a simpler solution would be to develop ore use some kind of a screen recording software. Maybe VNC.

share|improve this answer
OP doesn't want to display the app on the connecting device, but rather launch an app that will be tied to the display on the remote host. No need for local X servers / VNC. – viraptor Aug 17 '11 at 15:02

You must log in to answer this question.

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