Index.
03-Nov-2011: initial release.
Introduction.
There are times that it is convenient to run X programs from your home server on a remote workstation. If you are on a Linux or Unix machine this is not a problem if you are logged in using ssh and have X11 forwarding enabled. From a Windows machine it is more difficult. You can install Cygwin to run X applications or use a commercial product, but easier is to make the X screen available over the network using the VNC protocol. You can even configure it so that X and VNC are only running on the network. However, to make it secure you need to take some precautions.
Installation.
First you need to install Xorg, a desktop environment and some tools. I use LXDE because it’s light an low on resources. Desktops like KDE or Gnome are too heavy to run over the network and can really slowdown your server. Keep it simple. The following shows the command to install all the needed packages:
root@homsrv: ~# pacman --needed -S lxde xorg-xfs xterm xorg-xdm xdm-archlinux \
xorg-fonts-100dpi xf86-video-vesa xf86-video-fbdev x11vnc
:: There are 16 members in group lxde:
:: Repository community
1) gpicview 2) libfm 3) lxappearance 4) lxde-common 5) lxde-icon-theme
6) lxdm 7) lxlauncher
lxmenu-data 9) lxpanel 10) lxrandr
11) lxsession 12) lxtask 13) lxterminal 14) menu-cache 15) openbox
16) pcmanfm
Enter a selection (default=all):
warning: xorg-fonts-100dpi-1.0.1-3 is up to date -- skipping
resolving dependencies...
looking for inter-conflicts...
Targets (89): atk-2.2.0-1 libxcursor-1.1.12-1 xineramaproto-1.2.1-1
libxinerama-1.1.1-1 randrproto-1.3.2-1 libxrandr-1.3.2-1
compositeproto-0.4.2-1 libxcomposite-0.4.3-1
shared-mime-info-0.91-1 gdk-pixbuf2-2.24.0-1
gtk-update-icon-cache-2.24.7-1 gtk2-2.24.7-1 gpicview-0.2.2-1
perl-xml-parser-2.41-1 intltool-0.41.1-2 menu-cache-0.3.2-1
sg3_utils-1.30-1 polkit-0.102-1 parted-3.0-3
libatasmart-0.18-1 lsof-4.85-1 eject-2.1.5-7 udisks-1.0.4-1
desktop-file-utils-0.18-1 libfm-0.1.17-1 lxappearance-0.5.1-2
lxde-icon-theme-0.0.1-1 lxde-common-0.5.5-1 libxkbfile-1.0.7-1
xorg-xkbcomp-1.2.3-1 xkeyboard-config-2.4.1-1
xorg-setxkbmap-1.2.0-2 xorg-fonts-misc-1.0.1-1
xorg-server-common-1.11.1.902-1 xf86-input-evdev-2.6.0-4
xorg-server-1.11.1.902-1 consolekit-0.4.5-1 lxdm-0.4.1-4
xcb-util-0.3.6-2 startup-notification-0.12-1
gnome-menus-3.2.0.1-1 lxlauncher-0.2.2-1 lxmenu-data-0.1.2-1
alsa-lib-1.0.24.1-1 lxpanel-0.5.8-1 xorg-iceauth-1.0.5-1
xorg-sessreg-1.0.7-1 xorg-xcmsdb-1.0.3-2
xorg-xbacklight-1.1.2-2 xorg-xgamma-1.0.4-2 xorg-xhost-1.0.4-2
xorg-xinput-1.5.3-2 xorg-xmodmap-1.0.5-2 xorg-xrandr-1.3.5-1
mcpp-2.7.2-3 xorg-xrdb-1.0.9-1 xorg-xrefresh-1.0.4-2
xorg-xset-1.2.2-1 xorg-xsetroot-1.1.0-2 xorg-server-utils-7.6-2
lxrandr-0.1.2-1 lxsession-0.4.6.1-1 lxtask-0.1.4-3
vte-common-0.30.1-1 vte-0.28.2-2 lxterminal-0.1.11-1
giflib-4.1.6-4 libid3tag-0.15.1b-6 imlib2-1.4.5-1
openbox-3.5.0-4 pcmanfm-0.9.10-1 libfs-1.0.3-1
xorg-xfs-1.1.1-1 libxpm-3.5.9-1 libxaw-1.0.9-1
xorg-luit-1.1.0-2 xbitmaps-1.1.1-1 xterm-275-1
xorg-xdm-1.1.11-1 xorg-xmessage-1.0.3-1 xorg-xclock-1.0.5-1
xorg-xwininfo-1.1.2-1 xorg-xkill-1.0.3-2 xdm-archlinux-0.3-4
xf86-video-vesa-2.3.0-7 xf86-video-fbdev-0.4.2-5
recordproto-1.14.1-1 libxtst-1.2.0-1 x11vnc-0.9.13-1
Total Download Size: 26.14 MB
Total Installed Size: 111.94 MB
Proceed with installation? [Y/n]
:: Retrieving packages from extra...
atk-2.2.0-1-i686 260.1K 646.5K/s 00:00:00 [######################] 100%
libxcursor-1.1.12-... 25.1K 214.2K/s 00:00:00 [######################] 100%
A lot of boring stuff skipped ...
openbox-3.5.0-4-i686 323.7K 512.1K/s 00:00:01 [######################] 100%
pcmanfm-0.9.10-1-i686 137.4K 318.5K/s 00:00:00 [######################] 100%
xdm-archlinux-0.3-... 18.4K 137.7K/s 00:00:00 [######################] 100%
(89/89) checking package integrity [######################] 100%
(89/89) checking for file conflicts [######################] 100%
( 1/89) installing atk [######################] 100%
( 2/89) installing libxcursor [######################] 100%
More boring stuff skipped ...
(83/89) installing xorg-xkill [######################] 100%
(84/89) installing xdm-archlinux [######################] 100%
The Archlinux XDM theme was installed to /etc/X11/xdm/archlinux
To use it, make the xdm line near the end of /etc/inittab read;
x:5:respawn:/usr/bin/xdm -nodaemon -config /etc/X11/xdm/archlinux/xdm-config
Then make sure the default runlevel is 5 so that Archlinux will boot into XDM.
For this, change 3 to 5 on the first line after the comments in inittab;
id:5:initdefault:
If you want an xconsole on the login screen, or don't want the clock or the
halt and reboot buttons, edit /etc/X11/xdm/archlinux/Xsetup
Enjoy
PS: If you ever have trouble with Arch booting into X, and therefore wish it
wouldn't boot to runlevel 5, all you have to do is pass 3 as a perameter
to the kernel. This is quite simple to do with both lilo and grub.
(85/89) installing xf86-video-vesa [######################] 100%
(86/89) installing xf86-video-fbdev [######################] 100%
(87/89) installing recordproto [######################] 100%
(88/89) installing libxtst [######################] 100%
(89/89) installing x11vnc [######################] 100%
Optional dependencies for x11vnc
tk: for GUI support
root@homsrv: ~#
We will use XDM as login manager with Arch theme, so use the comments above to change the line in /etc/inittab for xdm to include -config /etc/X11/xdm/archlinux/xdm-config. Then change /etc/X11/xdm/archlinux/Xsetup using the following diff:
--- Xsetup.orig 2011-08-10 15:54:04.000000000 +0200 +++ Xsetup 2011-11-02 15:56:41.733192450 +0100 @@ -4,6 +4,8 @@ xsetroot -solid "#223377" -cursor_name left_ptr ## these are all optional -/etc/X11/xdm/archlinux/buttons -geometry -0-0 & +#/etc/X11/xdm/archlinux/buttons -geometry -0-0 & xclock -geometry +0-0 & # xconsole -daemon -geometry 640x200-0+0 +/usr/bin/x11vnc -many -ncache 0 -nopw -o /var/log/x11vnc.log &
This removes the shutdown and reboot buttons from the login screen and adds x11vnc to the running X window. At this moment we are ready to test it, so as root give telinit 5 to switch to runlevel 5. If a real monitor is connected to your machine you should see the X login window. But using a vncviewer you must now be able to connect to your server too from a workstation on your network.
Plan B.
The solution above uses the existing X window and so what you do on the real screen and keyboard is the same as you do and see on the remote screen and keyboard. If you don’t want a real screen keyboard, but just the console in case you need it, you can make it so that you only have a remote X screen with the VNC protocol. For this you need the tightvnc package. In that package you find the Xvnc binary, this is an X server with a virtual display. This solution is faster then the x11vnc solution. Normally you should start it with the vncviewer script, but in our case it will be started directly from xdm.
First download and install all packages from above without x11vnc. Then only do the change in /etc/inittab so that X will start in runlevel 5. Add the following lines to/etc/X11/xdm/archlinux/xdm-config:
DisplayManager._1.setup: /etc/X11/xdm/archlinux/Xsetup DisplayManager._1.startup: /etc/X11/xdm/archlinux/Xstartup DisplayManager._1.reset: /etc/X11/xdm/TakeConsole
Then edit /etc/X11/xdm/Xservers:
# # Xservers file, workstation prototype # # This file should contain an entry to start the server on the # local display; if you have more than one display (not screen), # you can add entries to the list (one per line). If you also # have some X terminals connected which do not support XDMCP, # you can add them here as well. Each X terminal line should # look like: # XTerminalName:0 foreign # #:0 local /usr/bin/X :0 :1 local /usr/bin/Xvnc :1 -geometry 1280x896 -depth 16 -dpi 100 -nevershared -dontdisconnect -rfbauth /etc/vncpwd -fp /usr/share/fonts/misc/,/usr/share/fonts/75dpi/,/usr/share/fonts/100dpi/
Note that the last three lines are actually one long line! Oke, in this example there is some protection for the VNC server, see the -rfbauth /etc/vncpwd command line option. To create this password file as root do:
[root@homsrv ~]# vncpasswd /etc/vncpwd Password: Verify: Would you like to enter a view-only password (y/n)? n [root@homsrv ~]#
After you have all done this, give telinit 5 to start runlevel 5. Then test it with vncviewer homsrv:5901. You need to give the port number now because this setup uses port 5901 instead of 5900.
I commented out the line that starts X on screen :0, but if you don’t do that the real screen will work as well and independent from the remote screen.
Download.
As usual, the configuration files:
