Linux desktop on a Windows PC

by DavidKirk

If you want to display your Linux desktop on your Windows PC, here is how you can go about it.

On your Windows PC, install Cygwin with XFree86 (or Xorg) and copy <cygwin_dir>/usr/X11R6/bin/startxdmcp.bat as <cygwin_dir>/usr/X11R6/bin/desktop.bat. If you edit startxdmcp.bat directly, all your changes will be lost if you update Cygwin.

Edit desktop.bat and change the following lines:

        SET REMOTE_HOST=<ip address of the linux box>

        run XWin -query %REMOTE_HOST% -fullscreen -clipboard -unixkill -nowinkill

If you use KDM

On your Linux PC, edit kdmrc and enable XDMCP:

        [Xdmcp]
        Enable=true

Edit Xaccess and uncomment the following lines:

        *                               #Any host can get a login window.
        *       CHOOSER BROADCAST       #Any indirect host can get a chooser

Restart kdm with the command:

        /etc/init.d/kdm restart

If you use GDM

On my SuSE 9.2 box I just hit ALT-F2 and ran "kdesu gdmsetup". I enabled XDMCP in the last tab. Then I logged out and hit CTRL-ALT-Backspace to kill the Display Manager and reload it.

Give it a try

Run desktop.bat on the Windows PC. It should start an X server on your Windows PC and display a login prompt from your linux box. Once logged in you will have your normal Linux desktop. The only things that are different are that you can't use things like Alt-Tab, Ctrl-Alt-Del and maybe a few others. Some of these things can be changed in desktop.bat.

Linux apps on your Windows Desktop

I've heard that XDMCP isn't the most secure way of displaying stuff remotely, so it is probably better to run individual Linux applications on your Windows desktop. Here's how I do it:

NOTE: if you already had Cygwin/X running, to display your Linux desktop as described above, you will need to log out and kill it (with CTRL-ALT-Backspace) before doing this next bit.

  1. Run <cygwin_dir>/usr/X11R6/bin/startxwin.bat. This will run X in multi-window mode. You will se an X icon in your system tray.
  2. Now ssh or telnet in to your linux box (with X forwarding enabled) and run your favourite Linux application. It should start up on your Windows desktop.
  3. To make this easier, you could install the PuTTY suite of programs that includes PuTTY, PSCP, PSFTP, Plink, PAgent and PuTTYgen.
  4. Use PuTTYgen to generate a public and private key. Copy the public key to the clipboard and paste it in to .ssh/authorized_keys on your linux box.
  5. Now run PAgent and load your private key. You will be prompted to enter your pass phrase. Once you have typed it in you won't have to do it again until the next time you load PAgent (which would usually be after a reboot).
  6. Now you can use Plink to run your Linux app:
        plink.exe -ssh -X -batch -l <your user id> -i <path to your private key> <linux hostname> <application>
-ssh means to use the secure shell protocol
-X enables forwarding X to your PC
-batch disables all interactive prompts
-l <your user id> is the account you log in to the Linux box with
-i <path to your private key> this is the key you generated with PuTTYgen
<linux hostname> this is the name or IP address of your Linux box
<application> this is the command you want to run on the Linux box (with the full path if necessary)

Here is how I run the Firefox web browser from my Linux box called kahlua:

        plink.exe" -ssh -X -batch -l david -i c:\David.ppk kahlua firefox

You can create a new shortcut called "Firefox" on your desktop (or wherever you want) with that command in it so you can run your remote application by double clicking on it. Now you can copy that shortcut as many times as you like and just change the application on the end of the command. Don't forget to rename the shortcut once you have done it.

If you need more information about public-key authentication. Check out the excellent documentation for PuTTY at http://the.earth.li/~sgtatham/putty/0.54/htmldoc/Contents.html.