X Window System/remote session/desktop

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
< X Window System‎ | remote session
Revision as of 23:10, 9 October 2015 by Woozle (talk | contribs) (similarity to VNC)
Jump to navigation Jump to search

You can set up a window on your machine which will appear like a monitor which is booting into the remote system. This is a little more complicated than the other remote session method, but is more like "being there". (This is similar to the functionality of VNC, but designed into the system rather than being a kluge on top of it.)

It also can't work if your local machine is not exposed directly to the remote machine – the remote needs to be able to access your local machine directly via an IP address. This means that the local machine cannot be behind a NAT wall.

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).

  • On the local (client) machine (note the space before the ":"):
    Xnest -ac :1
  • On the remote machine (via ssh or equivalent):
    export DISPLAY=yourmachine:1
    • ...where yourmachine is the name or IP address of your local machine (relative to the remote).
    • 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:

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 -- but it's basically the same mechanism, just with some more sophisticated capabilities under the hood (as far as I can tell).

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). (This problem seems to have been fixed as of July 2006; not sure whether it was with the client or the server, but it now works fine with Kubuntu 6 connecting to Fedora Core 4.)
  • 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. (This problem also has gone away.)
  • The contents of the local X window are scaled to about 75%, making some things hard to read; there's probably a command-line option to change this, but it doesn't seem to be adjustable during runtime. (Automatic scaling when the user mouse-adjusts the window size would be nice; a drop-down menu on the Xnest window would also be good.)

Question

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.