Run your own home-entertainment server with Linux and MythTV: we show you how.

by Jo Shields on 4 October 2007, 14:52

Tags: HEXUS, Linux

Quick Link: HEXUS.net/qajyv

Add to My Vault: x

So close a friend, and yet so remote

Connecting to a remote UNIX-like machine via a text console is both powerful and useful, but occasionally you want something clickable. Therefore, we're going to install a VNC server, which will allow remote GUI connections to your server. First we need to enable something called XDMCP. XDMCP allows one UNIX-like system to access another UNIX-like system's login screen, in an insecure manner. We're going to enable it, but we won't use it across the network - instead, a VNC server will be installed alongside which acts as a middle-man.

First, click System, Administration, Login Window. Under the "Remote" tab select "Same as local" for the screen type, click the "Configure XDMCP" button at the bottom, and ensure that indirect XDMCP is disabled (as it is a security risk). Close that window. Now we need to install a VNC server, and an "inetd" server - an inetd is in charge of receiving external connections on a network, then running an appropriate program to take care of the connection - in this case, the inetd will run the VNC server for us as & when required. Install the "openbsd-inetd" and "vnc4server" packages - I've selected these as they seem best behaved on 64-bit computers, and that way I only need one set of instructions. Run "gksu gedit /etc/services" and at the bottom of the file, add a line which will give a name to your VNC port. VNC port numbers start at 5900, so a VNC connection to "machinename:7" will actually connect on port 5907.
publicvnc 5900/tcp

Now we will configure the VNC server. The config file for it is quite lengthy, but we can ask it to read in the main system GUI config file and extract what it needs to know. Run "gksu gedit /etc/vnc.conf" and add a line:
$XFConfigPath = "/etc/X11/xorg.conf";

Finally, we will configure inetd. Run "gksu gedit /etc/inetd.conf" and add this line:
publicvnc stream tcp nowait nobody /usr/bin/Xvnc Xvnc -inetd -query localhost -once -depth 24 -geometry 1024x768 -AlwaysShared -SecurityTypes=None -extensions XFIXES

That should all be on one line. Change the resolution and colour depth if you like, but the higher you go, the more bandwidth you need. Don't worry about the SecurityTypes bit, it means VNC won't ask for a password (the main GDM login screen still will though). That should be it - multiple users should be able to connect to the same port at once, bandwidth and CPU permitting. We just need to tell the inetd to read in the new config file, so run "gksu invoke-rc.d openbsd-inetd reload"