Run a GUI app on remote computer from SSH

11,871

Solution 1

Something like this should work:

#on your desktop 
xhost + #not secure, make sure your X isn't listening on any tcp ports.
echo 'export DISPLAY=:0; x-command-you-want &' > ~/run-command
chmod +x ~/run-command
#on your server
ssh user@desktop '~/run-command'

Solution 2

This works for me once I'm ssh'd in:

export DISPLAY=:0; nohup iceweasel &>/dev/null &
Share:
11,871

Related videos on Youtube

Patrick
Author by

Patrick

I am a passionate Product Developer who loves creating new products for web and mobile use. It is my passion to tackle challenging problems, where I serve my users the best experience possible while writing as little written software as possible.

Updated on September 17, 2022

Comments

  • Patrick
    Patrick almost 2 years

    I want to run a GUI application on my Ubuntu computer, but it should started by a shell script on my Debian server trought SSH.

    Is this possible?

    • pkaeding
      pkaeding over 13 years
      It seems there is a little confusion over what you are trying to do. Are you trying to run a GUI program on a remote host, but have the GUI window appear on your local host? Or are you trying to run an application locally (and have the window appear locally), but have it triggered remotely?
    • barlop
      barlop about 9 years
      @pkaeding well if there are two interpretations, both useful, then you can answer for both. Do you know? Already somebody has commented asking re one of those interpretations " Alexander wrote " It's been a while, but maybe you still remember if you were able to start TeamViewer from ssh. I would appreciate if you could share more detail on how you did that. Thanks." <--- So, if you knew and answered for both, it might've helped him and others.
  • Tyler Hoppe
    Tyler Hoppe over 13 years
    He wanted the server to run a GUI program on the desktop, aka the server connect to the desktop and execute the program.
  • Alexander Chertov
    Alexander Chertov over 10 years
    Hi. It's been a while, but maybe you still remember if you were able to start TeamViewer from ssh. I would appreciate if you could share more detail on how you did that. Thanks.