5

I am new to SSH. I can connect to a remote computer. I can also launch an application on a remote computer and see its GUI on my screen.

But I do not know how to launch an application without it producing output on my screen.

I want to launch an application (eg. rhythmbox), and close the ssh connection, leaving the application running, without sending any output to my screen.

Surfing the web I have found some advice, but nothing helped me;

ssh -X name@domain
nohup rhythmbox &
logout
Zanna
  • 72,312
0xDE4E15B
  • 187

1 Answers1

3

Do you mean you want Rhythmbox to display onto the remote computer's screen? The screen onto which a GUI application is displayed is indicated by the DISPLAY environment variable. When you run ssh -X, DISPLAY is set to a value that indicates that display requests must be forwarded over the SSH connection. To make the application display on the remote computer's screen, set DISPLAY to the value :0.

ssh username@example.com 'DISPLAY=:0 rhythmbox &'

There's one more hurdle: when an application connects to an X display, it needs to provide a sort of password called a cookie. The cookie is generated each time the X server starts. Ubuntu stores the cookie in a file with a randomly generated name. The easiest way to find the cookie is to store it in a well-known file name when the X server starts. On Ubuntu, add this code to your ~/.profile:

case $DISPLAY:$XAUTHORITY in
  :*:?*)
    # DISPLAY is set and points to a local display, and XAUTHORITY is
    # set, so merge the contents of `$XAUTHORITY` into ~/.Xauthority.
    XAUTHORITY=~/.Xauthority xauth merge "$XAUTHORITY";;
esac

For more background, see ssh DISPLAY variable.


Or did you mean you never ever want to see the Rhythmbox window? If so, make it connect to a virtual X server, xvfb Install xvfb. Start the virtual X server, then tell Rhythmbox to connect to it.

ssh username@example.com 'Xvfb :1 -screen 0 800x600x8 & sleep 1; DISPLAY=:1 rhythmbox &'
Glorfindel
  • 975
  • 3
  • 15
  • 21