Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Aug 17 '11 at 18:17

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

add comment

3 Answers 3

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
add comment
ssh -n remotehost env DISPLAY=:0 <command> &
share|improve this answer
add comment

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
add comment

Your Answer

 
discard

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