Starting a program on the desktop from SSH in Ubuntu

I'm logged into my Ubuntu 11.04 box using SSH, and I need to start a program - but it is a Windows GUI program which runs under WINE.

How can I start the program from the SSH terminal so that it opens on the desktop, and then stays open even after I log out of SSH.

3 Answers

The general way to start a graphical program from a remote machine:

  1. On the target machine run xhost +. (You'll need to do this from a terminal, or from a login script.)

  2. from a remote client, SSH into the target machine and run nohup program & where "program" is the program as you would run it if you were sitting at the target machine.

1

If you want the program forwarded to your Display connect with ssh -X.

But I guess you want to start the program on the remote display?

  1. Use screen to keep the program open.

  2. Start the program with the right user and DISPLAY variable of the running X-Session.

For example:

xterm -display :1000.0

or:

DISPLAY=:1000.0 xterm

This should work with Wine as well.

Make sure you have sshd set up so that it allows X11 forwarding.

Then, just start your GUI as per normal (nohup if you want it to run after you log out) and it will appear on your machine.

Edit: if you wanted this to run from an icon (see comment) then you can alias the icon command to

ssh 'nohup MyProgram &'

Or just create a small shell script (called ~/bin/runme.sh) on the remote host with this in it:

#!/bin/sh
nohup MyProgram & 2>&1 $HOME/.nohupp.log

and invoke with

ssh ~/bin/runme.sh
4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like