Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is it possible to use ssh to start applications remotely? I have a linux machine for a mediacenter and I want to be able to connect through ssh and start for example XBMC or Boxee on it and then use my iphone as a remote.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Sure:

$ DISPLAY=:0 /usr/bin/xbmc

(after you ssh into the machine of course)

share|improve this answer
    
so basicly by adding DISPLAY:0 in front of the command. Thanks man. –  Stulli May 18 '09 at 17:29
    
Of course you could do this in one line too: ssh user@server "DISPLAY=:0 /user/bin/xmbc" –  x3ja May 19 '09 at 14:04

I took a different slant on what the OP asked and now realise I might have gone in the wrong direction. Had written the full answer below before I realised this, and think some people might find this looking for the other interpretation.

The advice below is if you want to start the application remotely but view it locally (i.e. run on mediacenter, view on another PC).

You could use:

ssh -X user@server

/usr/bin/xmbc

The -X just means "use X11 Forwarding".

To get it all in one line you could just do:

ssh -X user@server "/user/bin/xmbc"

This will only work if the server (in this case your mediacenter) has the X11 forwarding option enabled (normally in /etc/ssh/sshd_config and the option is X11Forwarding yes - restart ssh after you change this - /etc/init.d/ssh restart)

Now, if you're really wanting ease of use, you could key share between the two computers and then make an icon on your desktop that ran the above command and you'd have passwordless access to it!

share|improve this answer
    
In some cases I've had to use the -Y option instead of the -X option when doing this... –  David Z May 18 '09 at 21:19
    
This actually might come in handy. Thanks –  Stulli May 19 '09 at 9:02

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.