X window Server Windows to Linux

0

On the web there are many manuals showing how to connect from Windows to Linux and get an X session window but do not indicate otherwise, that's my concern: How to view linux Windows programs with Protocol X [X window server]?

Sorry for my poor English ...

chimpaburro

Posted 2012-11-17T20:20:44.823

Reputation: 13

Answers

3

There are several ways:

  1. VNC

    • Install a VNC server on the Windows machine. You can use TightVNC for example. Make sure you configured it to listen on a non-loopback IP address and it is not blocked by a Firewall.
    • Install a VNC client on the Linux machine. If you use Debian or Ubuntu, you can do it with the following command in a terminal:

      $ sudo apt-get install xtightvncviewer
      
    • Connect to the Windows box (assume the IP address of the Windows machine is is 192.168.1.10):

      $ xtightvncviewer 192.168.1.10
      
  2. RDP

    The standard Windows Remote Desktop Protocol. At usual it does not require any special configuration on the Windows side except setting Allow users to connect remotely to this computer checkbox in System Properties and adding a user to Remote Desktop Users group.

    On the Linux side you got to:

    • Install the rdesktop client. For Ubuntu or Debian you can use the following command:

      $ sudo apt-get install rdesktop
      
    • Connect to the Windows machine (assume its IP address is 192.168.1.10):

      $ rdesktop 192.168.1.10
      
  3. X11

    If you run an X11 server on a Windows machine (Cygwin/X or Xming for example) then the communication is pretty straightforward as the X window system was designed to be network-transparent. The main thing that we touch is an application can be executed and displayed on different machines. You run an application locally, but specify a DISPLAY where the application is shown.

    In your case the Windows box (say 192.168.1.10) runs an application and the Linux box (say 192.168.1.11) displays the application. In fact, the windows machine does not require to run an X server to run the application - it simply can display it on a remote Linux box:

    $ DISPLAY="192.168.1.11:0" xterm
    

    When you run the command on a Windows machine it will run xterm locally, but display it on a remote X server which runs on a separate machine. When you run the command on a Windows machine you should see the terminal window openned on a Linux machine (remotely).

    The DISPLAY is an environment variable that holds an address and number of the current display. Every X application looks into this variable to know where to render itself. The important thing to understand is the xterm (for example) does not distinguish whether it displays itself to a local X server or a remote X server. It is network transparent. For example, if you run xterm and just say:

    $ echo $DISPLAY
    

    It will print a current DISPLAY to which all applications display itself. By overriding this variable you tell the application to display itself somewhere else. I hope the concept is clear now.

    Note that it is likely your Linux X Server rejects all incoming connections for security reason. To allow connections from your Windows box run the following command:

    $ xhost +192.168.1.10
    

    Actually this way is a bit insecure, because everybody who assigns this IP address to itself may connect to the X server.

    Fortunately, there is a great and secure way. Since the X server just listen a TCP port - we can forward it to a local machine over an encrypted channel using ssh which has this awesome feature. You will need an ssh daemon running on the Windows machine. You can use openssh from cygwin - it is easy, just set up the cygwin with selecting the openssh package and then open a terminal and run ssh-host-config, but don't forget to set X11Forwarding yes in sshd_config.

    Now, how it looks like. On a Linux box you run:

        $ ssh -X user@192.168.1.10 xterm
    

    And after entering the password you should see the xterm window which is executed on a Windows machine but displayed on a Linux machine. After authorization ssh binds to a port on a Windows machine where it listens for connections and forwards packets over the established channel to a local port on a Linux machine (usually 6000 for display 0). Then it runs the xterm with setting DISPLAY to the bound port allowing xterm to display itself on a remote X server over an encrypted channel. In this case you don't need to run xhost since the X server does not need to accept any external connections.

    Now, how to run application on a Linux box and display it on a Windows box:

    On a Windows machine you will need an X server (Xming for example) and an SSH client (PuTTY for example). First, ensure the Xming running (there is a tray icon). Then, open PuTTY, choose ssh, fill login and password boxes, also ensure the X11 Forwarding in SSH settings is checked. Then just click connect and after that it will connect to the Linux box with opening a terminal window. You can run xterm there and it will be displayed on a local Xming server (since it is forwarded by PuTTY to a remote machine). Also look at this guide - there are some screenshots.

Dmitry Vasilyanov

Posted 2012-11-17T20:20:44.823

Reputation: 246

As the answer points out, a popular option is to install cygwin with X11 support. – tniles – 2016-06-03T17:31:54.990

Hey vdmit11, please explain me a little more the last step (step 3), I use Xming X terminal but can not find it anywhere ...... – chimpaburro – 2012-11-17T23:16:18.787

I can not find the X terminal... – chimpaburro – 2012-11-17T23:30:27.527

OK All is clear now, but.. in the moment: ssh -X user@192.168.1.10 xterm (changed the ip and the user for the my) return error = xterm: not found... – chimpaburro – 2012-11-18T00:20:20.583

It is not found because it is not installed on your windows machine. You can't run a non-X application over the X protocol. You can't run explorer.exe for example, but you can install xterm or any other X application. I actually have no Windows machine right now so I can't install Xming to check what applications are there. You better to try in opposite direction: connect through ssh to a linux machine, run xterm there, but display it on the forwarded Xming. – Dmitry Vasilyanov – 2012-11-18T00:23:14.003

Ok, thank you very much I will continue my search and you gave me a way. – chimpaburro – 2012-11-18T00:42:11.747

1

Windows does not support the X protocol. What I would do is look for something that talks Windows RDP (remote desktop protocol). An example, not personally verified, might be rdesktop.

Nicole Hamilton

Posted 2012-11-17T20:20:44.823

Reputation: 8 987

thanks but no single protocol that starts some unwanted programs and not all the Desktop – chimpaburro – 2012-11-17T21:15:58.750

Unfortunately, RDP is what it is. – Nicole Hamilton – 2012-11-17T21:23:36.040

RDP does have a single-program-per-connection mode. – user1686 – 2012-11-17T23:03:26.287

yes grawity, and this is my need – chimpaburro – 2012-11-17T23:26:51.453