Creating and connecting to persistent remote X11 sessions

X2GO and XPRA can be used to run (and interact with) GUI applications on remote hosts. For all systems off of the sbgrid network it will be easiest if you use the cmcd-vpn. Please contact us if your SBGrid-supported remote host lacks pre-requisite server-side software, such as the xpra program.

x2go

Download and install the X2GO client.

You will need to open System Preferences - Security - General - Temporarily 'Allow from anywhere' open the application, make sure you can reopen it. Then change your security setting back to 'App Store and Identified Developers'

x2go requires XQuartz - see faq-using-sbgrid-programs if you do not already have it installed.

From the x2go application - Create a new session Make sure you fill out the following -

  1. host - the host that you want to connect to.
  2. login - your username
  3. port - 22
  4. Session type - Mate

You can adjust the desktop size after the session has started.

Xpra

macOS (x86_64) to remote Linux workstation

Download the installer.

On remote workstation

Copy xpra-launch.sh to your home folder and ./xpra-launch.sh, or use one of the commands below.

Full desktop

tmux new-session -d -s "xpra-desktop" "xpra start-desktop --start=mate-session :$((10 + RANDOM % 999)) --pulseaudio=no --daemon=no"

Minimal termial window

tmux new-session -d -s "xpra-terminal" "xpra start --start=mate-terminal :$((10 + RANDOM % 999)) --pulseaudio=no --daemon=no"

On local computer

Launch the XPRA gui. Select mode ssh - enter username, host and password info. If there is only one xpra session it will automatically connect to it. You can also save that info to a config file and launch that after.

To end the session on the remote system either tmux a and Ctrl-c or 'xpra stop'

xpra cli - keep it simple (for more experienced XPRA users)

This subsection includes support staff notes is not needed for basic remote work with GUI applications. You need to modify these commands according to your circumstances, should you decide to use these commands.

On the local Mac OSX system one can open a terminal window and run something like

xpra start ssh/<username>@<remotehost>/42 --start-child=xterm

With this one command you should have a remote xterm window come up. From there you can launch whatever application you need to run on the other system, including applications that need GLX extensions such as coot.

To disconnect, just Ctrl-c from the original terminal window (not the xterm that you connected to), or if you connect from another system it will automatically detach.

Reattach to existing desktop

xpra attach ssh/oconnor@sch-boltzmann/42

Note the number 42. You need to pick a number that someone else on the system is not using. Do not use a low number that could be in use by the system, like 0 - 5. Pick a higher number up to 999 instead.

Note, if you simply close all the windows, including xterm, the remote server is still running:

$ ssh oconnor@sch-boltzmann
$ xpra list
Found the following xpra sessions:
/run/user/46627/xpra:
        LIVE session at :666
$ xpra stop :666
xpra at :666 has exited.

Or if you wanted the session to end when you opened the window:

xpra start ssh/oconnor@sch-boltzmann/42 --start-child=xterm --window-close=shutdown

For all systems off of the sbgrid network it will be easiest if you use the cmcd-vpn.

Troubleshooting tips

Ideally you would have already set up SSH with keys

Make sure you can ssh to the host without error. You should not need to type 'yes' for ssh keys, etc.

Press enter one time - is it waiting for password input?

connect to the remote host and type:

xpra list

If there is an active session you can connect to it via xpra attach ssh/user@host/42 from your client.

There could be an active session with no windows open. Stop the session and start again.

xpra stop :42

Launch a session from the host in a tmux or screen session on the remote server:

ssh user@myhost
tmux
xpra start :617 --daemon=no --start-child=xterm

You should see a line that that contains xpra is ready. Detach with CTRL-b - d keys and then you can attach from your own system xpra attach ssh/oconnor@sch-boltzmann/617

See Also man xpra