From Remeis-Wiki
Jump to: navigation, search

Working remotely using XPRA and SSH

XPRA allows you to start remote X programs and display them on your local machine. Winswitch uses XPRA internally, but you can use it directly as well. Especially, you can use the speed of SSH for commands, but don't need to use X11-forwarding during your SSH-connection, which can be very slow.

First, you need to install XPRA on your local machine. If you are using a Debian-based UNIX-system you can get XPRA via

sudo apt-get install xpra

Please note that you might not get the current version of XPRA depending on your distribution. Instead you can add the winswitch-repository to your package list.

step 1: starting an XPRA-server at Remeis

First establish a SSH-connection to your favourite machine on Remeis:

you@local:~> ssh constellation.sternwarte.uni-erlangen.de

Now start an XPRA-server using

username@constellation:~> xpra start :123

The :123 is an arbitrary display port which any X program will use in a minute. Please note that :0 is reserved for the physical display on your remote desk! To ensure that all X programs will use the XPRA-server you need to modify the DISPLAY environmental variable. In a CSH, you can use

username@constellation:~> setenv DISPLAY :123

step 2: connecting to the XPRA-server

Finally, to display all X program on your local machine, open a new shell and attach the XPRA-session:

you@local:~> xpra attach ssh:constellation.sternwarte.uni-erlangen.de:123

Here, :123 is again the display port XPRA is using. Any X program or window you start in the SSH-connection will open at your local machine. This work even for plot windows in, e.g., ISIS.

step 2+N: open more SSH connections

Once you need N more terminals on the remeis machines, but still want to forward their X windows to your local machine, just start another SSH-connection and set the DISPLAY variable:

you@local:~> ssh constellation.sternwarte.uni-erlangen.de
username@constellation:~> setenv DISPLAY :123

final step: shutting down the XPRA-server

If your done with your work you should stop the XPRA-server to free the display port:

username@constellation:~> xpra stop :123