How to use Cygwin to work with a Linux Server
A lot of Linux systems are installed on old cast-away systems for testing purposes, and there they languish. Oddly
enough, people generally don't want to use that old blurry 15" monitor and Trident 512 video card for web browsing, and
they may not want (or be able) to smack down the Windows installation on their main computer just yet. Luckily, it just
so happens that Unix is designed for seamlessly transparent remote usage.
Like the Perl motto says, "There's more than one way to do it." There are two ways to get a remote display from your
Linux computer to your Windows computer: VNC and X. VNC is attractive for several reasons: it is very simple, it's very
familiar to people who've used it in Windows as a PC Anywhere replacement, and it's relatively light on bandwidth.
However, VNC is not well designed for this scenario. Like PC Anywhere, the VNC server regularly checks the screen to see
what's happened and sends that to the client, while the client regularly checks the mouse and keyboard and sends that to
the server. In the above example of a Trident 512, your Linux experience will still be limited to working with a
640x480x256 display, albeit as a window on your nice monitor.
This is where the venerable X comes to the rescue, but first we need to reverse some miseducation. If you've read a
bit of Linux documentation before, you may have come across something like: "In X the terms server and client are
reversed; don't worry about that, it's not important." Au contraire, it is important. In X, the server is not the
big computer down at the data center -- rather, it is the part of the program that handles video cards, monitors,
keyboards, and mice. The client is not the computer you're sitting at -- rather, it is the program which wants to show
you something graphical. The client (say, the gedit text editor on Computer A) calls some local X libraries which
direct its requests for action to the X server (say, X on Computer B).
X does not care (so long as the security policy is met) if the client and server are on the same computer, same LAN,
or same continent. It also does not care if there is any display hardware on Computer A at all, for that matter, much
less if it's just a Trident 512. If Computer B can display 1280x1024x16000, that's the desktop that gedit is going
to be drawing into. Now, on to the instructions.
We're going to assume that Computer A is the Linux server and that a more-or-less default installation of Mandrake or
something similiar is on it, running in runlevel 5 (graphical login). We're going to assume that Computer B is a Windows
desktop or laptop on the same LAN. We're going to assume some other stuff too, like both of these computers are working,
that the LAN is secure, etc. XDMCP is not a secure protocol, so doing this over wireless is something to be very careful
about.
- Prepare the Linux server.
- This is going to be summarized from the
XDMCP-HOWTO, so if you need more information go there.
- Red Hat 7.x, Mandrake 8.x, and SuSE 8.x (or later versions of those OS's) users can skip this step. Make sure
that XFS (the X Font Server) is listening to the network: edit /etc/rc.d/init.d/xfs and make sure that the "-port"
flag uses 7100 instead of -1. If you did have to do this, you'll also need to edit your /etc/X11/XF86Config-4
file. service xfs restart.
- Tell the login manager to allow remote clients. There are three different login managers -- if you know you're
using gdm then feel free to just modify the gdm file, otherwise do them all and make sure.
- gdm. If you're using Red Hat or you've installed Ximian Desktop or you play 3d games, chances are good
you're using the Gnome Display Manager. Edit /etc/X11/gdm/gdm.conf, find [xdmcp] and change
Enable=false to Enable=true. Alternatively, log in as root and run gdm-config.
- kdm. The K Display Manager is the default for SuSE. Edit /usr/share/config/kdm/kdmrc, find
[xdmcp] and change Enable=false to Enable=true.
- mdkkdm. Mandrake has made changes to their version of KDM, but as far as I know they're cosmetic and
this should still work. I don't have it installed to test, so let me know if this is broken. Edit
/usr/share/config/kdm/kdmrc, find [xdmcp] and change Enable=false to Enable=true.
- xdm. X Display Manager is the default for Debian. It is configured by editing
/etc/X11/xdm/xdm-config. Just find DisplayManager.requestPort: 0 and comment it out with an exclamation
point: ! DisplayManager.requestPort: 0
- (SuSE users can skip this step). Set the X security policy: Assuming your network is secure, edit /etc/X11/xdm/Xaccess and uncomment the
asterisk line, like this. * # any host can get a login window. A more restrictive policy is fine, but beyond the
scope of this document. Have a look at The Linux Documentation Project for details on
better security for X sessions.
- Restart X. That can be done by rebooting, by typing telinit 3 && telinit 5 in a terminal, by logging out
and selecting an option from the KDM menu, or with CTRL-ALT-BACKSPACE. Told you there was more than one way :-)
- Prepare the Windows desktop.
- There are a lot of very nice commercial X servers for Windows: Reflections, Exceed, XWin32, X-ThinPro. The least
expensive that I know of is $250, which is a lot for home users. However, there is also a free X server in the
Cygwin distribution, which is pretty good. If you're using a commercial X server,
check the documentation for how to add a new connection. You should be able to start a connection with minimal
difficulty. If you need to use Cygwin, carry on.
- On the Windows desktop, go to http://www.cygwin.com and click the "Install
Cygwin Now!" button. This will download the installer. Select "Run" and "Install from Internet." If you want to glance
through the available packages knock yourself out, but the best thing to do is to just choose a mirror and let it go with
a default installation. It will work at this for some time, but shouldn't need to reboot. When it's done, try opening a
Cygwin window and typing startx. Don't worry about the heinously ugly screen that confronts you, this is the twm
window manager and will not be running most of the time. In fact, you can kill it now by pressing CTRL-C in the window
where you typed startx.
- Connect and log in.
- This is the easy part. In a Cygwin window, type X -broadcast and you will be presented with the login for
your server. Log in and enjoy.
- It's well worth reading the Cygwin documentation for other cool things you can do with it. You might want to
start with the Cygwin/XFree86 FAQ.