Showing posts with label X11. Show all posts
Showing posts with label X11. Show all posts

Monday, February 2, 2009

How to Run an X Server on Windows : An Introduction to Xming

Accessing your Linux machine remotely is a no-brainer on the command line thanks to built in support for services such as telnet and ssh. But what about accessing your GUI remotely?

Well on a Unix-based OS, it's pretty much just as easy, right out of the box. But thanks to great open-source software like Xming, it's just as easy from windows too.

Before we get started we will have to download and install Xming. You can download Xming directly from the project's download page on SourceForge. For starters, download the xming, xming-fonts and xming-tools-and-clients packages. The Xming and Xming-fonts packages download as executable's, so just run them and "next, next, next" your way through the install wizards; the xming-tools package downloads as a zip archive, so extract it to somewhere on the path (eg: c:\windows\system32).

You will also need a terminal client like PuTTY so download that here, and we'll be ready to go.

We'll be covering two scenarios in this tutorial

Running Individual Applications

. Fire up your Xming server using the start menu shortcut.You will see the Xming icon running in your taskbar. If you hold your mouse pointer over the icon, you will see a popup indicating the server number for this instance (you can run multiple X servers).
There are only three basic steps required to achieve this.
  1. Configure Access Control on the Source Machine.
    As with Linux, we will use the xhost utility to achieve this. The only difference is that this time you have to set the DISPLAY environment variable on the source machine too (this was done for you in Linux, because you were working within the X server environment).

    set DISPLAY=:0.0
    xhost +[hostname]:{X server number}
       eg. xhost +192.192.0.5:0.0

  2. Make a Terminal Connection to the Target Machine.
    Fire up PuTTY and use telnet or ssh to make a terminal (command line) connection to the machine you want to run the GUI application on.

  3. Set the DISPLAY environment variable on the Target Machine.
    The DISPLAY environment variable is used to choose the X server to attach to when running a GUI application. The variable is addressed as [X server hostname]:{X server instance number}. Set this variable to the hostname of your windows box (running Xming), and use the appropriate server instance number.

    export DISPLAY=192.192.0.3:0.0
That's it, you're ready to go, so fire up a GUI application to test it out (I always use something simple, fast and lightweight like xclock to test with).

Full Remote Desktop.

For this example, we'll be making use of Xming's Xlaunch component. But before we get started, we need to make sure that all the security is set up correctly.
  • Check Your Firewall.
    Check your firewall on the target machine, ensure that the X11 port is open (usually port 6000).

  • Configure Your Desktop Manager.
    If you're running Gnome, do the following:
    1. Run the GDM configuration application (as root)

      gksu gdmsetup

    2. Select the Security tab and ensure that "Deny TCP connections to Xserver" is disabled. You will have to restart your X server after applying these settings. Just kill your X server (ctrl + alt + backspace), it should automatically restart.

  • Fire up XLaunch.
    Use the start menu shortcut to start XLaunch



      • Select "One window"
      • Enter a display number
      • Select "next"


      • Select "Open session via XDMCP"
      • Select "next"


      • Either select "Connect to host" and enter the hostname or ip address of the target machine.
      • or, Select "search for hosts (broadcast)" to search for the target machine.
      • Select "next"


      • Accept the defaults and select "next"

      • Select "Finsh"




You now have a full "Remote Desktop" Linux environment from within Windows!

Sunday, January 4, 2009

x2vnc : One keyboard (and mouse) to control them all ...

So you need a windows machine (we're not going to go into why right now), in addition to your Linux box. The box in question is a complete physical box; but you discover it's becoming cumbersome managing two mice and keyboards on your desk.

What you need is x2vnc.


  1. Install x2vnc.

    Using your distro's package manager, install x2vnc. For example, on ubuntu : sudo apt-get install x2vnc does the trick. If x2vnc doesn't reside within your distro's repositories, you might have to install it directly from the author's site. At the time of publishing, the current version available was 1.7.2 and could be obtained here.

  2. Install a VNC server on the Windows box.

    You need to have a VNC server running on the windows box for this to work. There are various free alternatives available; one of which being TightVNC which can be obtained here. Install a VNC server, and start it up on the windows box.

  3. Fire up x2vnc

    There are various options available to you when running x2vnc; these can be obtained by running x2vnc --help; or see the "usage" section here.



    The most basic usage is
    x2vnc -east[|-west|-south|-north] {hostname/ip address}:{display}

    note:  The -east / -west / -south / -north parameter to use depends on where the windows box's screen is in relation to your screen. If the screen is to the right or yours, you use -east, and so forth.

    note:  If your VNC server is password protected, you will be prompted to enter the password directly after executing x2vnc.





Now for the big test, with x2vnc running, move your mouse "out of your screen" to the right (assuming you used the -east option). The mouse pointer should appear on your windows box's screen. You should notice that when the mouse pointer is visible on the windows box's screen, any keyboard activity (including shortcut key keystrokes) will be directed at the windows box, and visa versa.


As you also may have figured out by now, if you have more than one windows box, you could control all of them by running multiple instances of x2vnc.


Finally, if you would like to achieve the same effect with multiple Linux boxes (or anything running an X server), you should check out x2x.