Multiple Xming servers on a single Windows host

One use-case we have at work for Xming is to be the X11 server on a Windows RDP terminal server. For security reasons (don’t ask!) we can only access certain Unix hosts via an RDP session from our desktops, not directly over the campus LAN. So, we installed Xming on the TS and it works well. Except if two or more people wish to use it at once. Then it’s first come, first served.

I found a work-around for this that works, but is inelegant: start with a different display number argument.  For instance, the normal Xming start-up parameters are like this:

D:\Programs\Xming\Xming.exe :0 -clipboard -multiwindow

Change the :0 to be something else, and you can have a second (or third) instance running on the same host. Then, so long as you launch an xterm on the remote hosts using an item from your Xming menu, then it seems to pass the X11 packets back to your instance of the server, and not to other people on the same TS.

There are at least a couple of issues with this:

  • It’s not very resource efficient. But I can’t see a way around this, so long as we are using the RDP terminal server
  • You need to manually allocate display numbers to different people. If two people pick the same number, one will lose (first come, first served again). But at least your clients won’t end up on their server…

If anybody can think of a way to snoop which displays are already taken, then choose the next one, it’d be neat!

6 thoughts on “Multiple Xming servers on a single Windows host

  1. Thanks for the tip. Helped me out in a pinch when I couldn’t figure out why only one user could use Xming.

    Any ideas on why Xlaunch behaves the same way?

  2. I’ve done a script at work (can’t post it for security reasons) but it goes like this: use netstat and findstr to gather ports 6000-6099 (displays :0 to :99 respectively). Assign yourself the first available port. Start xming using this port. You can then either start PuTTY after manually defining the display in the session or remove the config frmom the PuTTY session and define the “display” variable on Windows (using “setx DISPLAY your IP:your port”) and afterwards start PuTTY.

  3. This is a script I used to do this :

    — snip —

    for /l %%x in (6000, 1, 6099) do (
    SET yval = 0
    SET xval = 0

    netstat -n | findstr “:%%x ” > NUL

    SET /A yval = “%%x – 6000”
    ECHO “C:\Program Files (x86)\Xming\xming.exe” :!yval! -clipboard -multiwindow
    “C:\Program Files (x86)\Xming\xming.exe” :!yval! -clipboard -multiwindow

    GOTO End
    ) ELSE (


    — snip —

    • Thanks, the code works! For those who find this useful, please be careful of the unicode that wordpress or something did to the above code. The double quotes ” and minus – signs are not the ones windows batch processors like.

Comments are closed.