X Window System/remote session

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< X Window System
Revision as of 13:47, 30 July 2006 by Woozle (talk | contribs) (→‎How: xephyr; pkg mgr)
Jump to navigation Jump to search

Computing: Linux: Running a remote X session

Explanation

The X Windows system, unlike many other more popular windowing systems, carefully separates the client (i.e. the part which the user sees and interacts with) from the server (i.e. the part which does all the work behind the scenes). This means that the client does not actually have to be running on the same machine as the server. It is possible to set up a window on one machine which is actually a session running on another machine – similar to VNC, but designed into the system rather than being a kluge on top of it. (However, see #Bugs.)

In order to do this, you will need Xnest running on the "client" machine. This is available in standard repositories for most Linux distributions (including Ubuntu and SuSE).

How

  • On the local (client) machine (note the space before the ":"):
Xnest -ac :1
  • Notes:
    • Xnest may not be installed by default; use the package manager to install it.
    • there are apparently better alternatives to Xnest; xserver-xephyr seems worth trying.
  • On the remote machine (via ssh or equivalent):
export DISPLAY=yourmachine:1

...where yourmachine is the name or IP address of your local machine. If you get messages indicating that it's having trouble connecting to yourmachine, try using an IP address instead. If you are using a Windows (Samba) network and machine names do not automatically resolve to IP addresses, use "nmblookup yourmachine" to get the address.

  • You will then need to run the command to start a GUI session; startkde starts KDE. Not sure what other commands might be available.

Bugs

  • Resized windows often don't display properly; the controls within the window resize, but the window itself won't grow past its original size. Controls which move outside the visible area become inaccessible, including the window-frame controls (max/min/close).
  • New windows often don't display at all (except in the taskbar, if they would normally show up there), but you can make them appear by clicking on the K menu in the taskbar.

Issues

Is there any way to automate this whole thing? As it is, you have to have two console windows open – one for the remote ssh session and one for the local session to start Xnest. Neither of those windows can be closed without killing the session. There must be some way to have one session spawn a batch file (.sh) which spawns Xnest, then spawns an ssh session to the remote which runs export (using nmblookup to get the local machine's IP address automatically would be nice), and then exits – but I'm not enough of a Linux guru to know how to do most of that.