How to run a desktop session on farhost while sitting at nearhost, without using a display manager. The session runs through ssh so it's all safely encrypted between you and farhost.

On nearhost, hit ctrl-alt-F1 to go to the console and run this (which you'll want to put inside a shell script):

xinit /usr/bin/x-terminal-emulator -class "Aside" \
   -display :1.0 -e ssh -CY farhost bash .xinitrc-nearhost \
   -- :1 vt7
It starts X on a spare terminal (vt7) on nearhost and runs a terminal emulator inside it. I'm on Debian so I invoke the terminal emulator as 'x-terminal-emulator', which in my case points to uxterm.

That terminal then runs the command following '-e' and that command starts a desktop session ('bash .xinitrc-nearhost') suitable for display on nearhost.

The file .xinitrc-nearhost resides on farhost and tells farhost what kind of desktop you want to run when the display is on nearhost. Example .xinitrc-nearhost:

xrdb -merge ~/.Xresources-nearhost
xsetroot -cursor_name left_ptr
x-terminal-emulator -e screen -p 0 -U -D -R &
exec /usr/bin/x-window-manager

A minor annoyance of running a desktop this way is that you have to start with an extra terminal, the one that ran the ssh command. However, you can mitigate by telling your window manager to recognize windows in the 'Aside' class as ones to be pushed away from normal view.

You can set the terminal's class as above with '-class "Aside"'. Then configure the window manager: my window manager is xmonad, so in my farhost:~/.xmonad/xmonad.hs, my 'manageHook' includes

className =? "Aside" --> doShift "9"
That pushes the startup terminal over to virtual desktop 9, so I can still see it when I want to but it isn't in my face right at startup.

Words

Pictures

Updated 2010-11-27 19:43 GMT