Setting up Xpra

Linux  Debian 

Install Xpra on the server and client:

apt-get install xpra

To easily use Xpra in a LAN/VPN for one command at a time, create the following script. Please note that this script will not work for a remote system behind a NAT without the necessary ports opened. Change HOST and PORT to the desired values.

#!/bin/sh

HOST=remote
PORT=20100

ssh $HOST -- xpra start :100 --start-child="$@" --exit-with-children --bind-tcp=0.0.0.0:$PORT

# Tries to open HOST:PORT up to 10 times
for i in $(seq 0 9); do
    if netcat -v -w 2 $HOST -z $PORT; then
        break;
    fi
    sleep 2
done

xpra attach --encoding=x264 tcp:$HOST:$PORT

Then use the script like this, assuming it’s called remote_xpra.sh:

./remote_xpra.sh xterm