Blog

Posted 2007/02/20

How to use Xnest to get a remote X session in a window

Most people know you can run a remote command and forward it back to your local display. Using Xnest you can run an entire remote window manager within your own X session.
export MACHINENAME="saturn.rdg.ac.uk"
export USERNAME="mjeg"
export REMOTECOMMAND="gnome-session"
Xnest :1 -br -name "$MACHINENAME" -kb -depth 16 -geometry 800x600 -sync -ac &
sleep 1
export DISPLAY=:1
ssh -X $USERNAME@$MACHINENAME $REMOTECOMMAND