4

I have two computers (a desktop and a laptop) running linux connected to my local area network. I like to ssh from my laptop over to my desktop and run programs there, and sometimes listen to music on my desktop, which is connected to my stereo system. Lately, I've been wanting to play movies on the desktop and desktop screen, but cue them from my laptop across the room.

Unfortunately, I cannot play a movie in the current X session running on my Desktop on from my laptop. What is odd about this is that I can listen to the audio coming from the speakers that are hooked up to my desktop, by playing the audio files over ssh! This tells me that there must be a way to send the movie to that Xsession, from the ssh shell that I am connected to.

Does anyone have any ideas about this?

4

All you have to do is set your $DISPLAY in your ssh session to match your desktop's display.

You could echo $DISPLAY from a terminal on the desktop, and then export $DISPLAY="what above said" in your ssh session.

  • 1
    You may also want to ensure that remote hosts are granted X authority via xhost + or xhost +<laptop_hostname> to be more secure. – Joseph R. May 23 '13 at 0:45
  • @JosephR. No. Many modern systems have X configured not to support TCP connections so xhost + has no effect. Anyway this is only useful if the movie player isn't running on the same machine as the display, which isn't the case here. – Gilles 'SO- stop being evil' May 23 '13 at 21:49
  • is there something similar to the $DISPLAY env variable, but for audio? For instance, if I wanted to ensure that a sound was not forwarded to my local computer... – pepper May 24 '13 at 16:49
  • Sound will not be forwarded, unless you go to some effort intentionally. – demure May 24 '13 at 17:09
0

Linux manages sound and display differently. You normally only get access to the screen if you've logged in locally, whereas sound is often available to all processes running on the system.

A GUI program knows where to display from the DISPLAY environment variable. That variable tells it which X server to contact. If one user is logged in locally on a machine, the display is normally :0. So in your ssh session, run

export DISPLAY=:0
mplayer /path/to/movie.mpg

Depending on your system's configuration, you may need to set XAUTHORITY as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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