If you're already running an X server on Windows (as you are with Xming), then the Windows side is mostly done (but see below for a few important details). The key bit remaining is to tell the X11 apps on the pi to send their X11 data to your Windows PC.
This is done via the DISPLAY
environment variable. Normally, if the X server and app are running on the same computer, DISPLAY will just specify the server number (e.g. :0
if you're only running one X server) or maybe a server and screen (e.g. :0.0
). Since there is no IP address, this tells the apps' X library that the server is local and connections will be made accordingly (probably though some kind of shared-memory transport).
To tell the app to send X11 data to a remote node, include an IP address in the DISPLAY
variable. For example, export DISPLAY=192.168.1.10:0
. This will tell any X11 apps that they need to open a TCP connection to X server #0 on node 192.168.1.10. DNS hostnames are fine here, if you've got them on your network.
Two potential problems
As I wrote in the first paragraph, simply running Xming may not be enough. There may be additional configuration necessary.
The first is that your X11 server must be configured to accept connections from remote nodes via TCP. Many X servers distributed today (I don't know about Xming) only accept connections from locally-running apps unless you explicitly configure them otherwise. This is a security feature, since every open socket is a potential vector for attack.
The second is that your X11 server maintains a database of hosts/users that are allowed to connect. You need to whitelist your Raspberry Pi's IP address. You can do this by running the xhost
command from Xming on Windows, for example, from a console running in an xterm. You can also type xhost +
to disable this security check, but that's dangerous because it will allow any app from anywhere in the world to open connections to your display. If you're behind a firewall on a LAN where you trust everybody (e.g. your own home), that's the easiest approach, but take the time to properly configure xhost
if you're not.
Alternative: ssh -Y
Using the above approach, your X11 apps will all try to open TCP connections to your X server. These connections are not secure. Someone on your LAN snooping packets can intercept them.
To solve this problem, instead of setting the DISPLAY variable on the Raspberry pi, use the -Y
parameter when connecting to it (e.g. slogin -Y hostname
). The -Y parameter (like -X) will create a tunnel between the nodes for carrying X11 traffic. This will keep the X11 traffic encrypted and secure. It will also assign its own DISPLAY environment variable so apps will use the tunnel. It may also eliminate the need to mess with xhost
since (as far as your X server is concerned) the connections are originating locally (from the originating side of the SSH tunnel).