Xlib : connection refused by server

You may get the below error while running xhost + on Linux environment.

Xlib : connection refused by server
The IP address of this Linux environment is 192.168.1.7
Sceen 1

If your X Server running on Windows is Xming, then the fix is to be done from Xming's side, ie, from the Windows operating system.

The Xming logs shows the below error :

AUDIT: Sun Feb 02 11:56:00 2014: 4324 G:\Program_Files_(x86)\Xming\Xming.exe: client 4 rejected from IP 192.168.1.7

Hence, the rejection happens from the client running on Linux with IP address 192.168.1.7

The fix is to find the file X0.hosts in the installation folder of Xming (This, to me is on folder G:\Program_Files_(x86)\Xming). Open this file. You will see the content of this file will be a single line of localhost

Add the IP address of the host (in my case, 192.168.1.7) you want to connect to in the file X0.hosts

localhost
192.168.1.7

From the terminal, set the DISPLAY

DISPLAY=192.168.1.50:0.0
export DISPLAY

Run xhost + again

$ xhost +
access control disabled, clients can connect from any host
xhost:  must be on local machine to enable or disable access control.
Successful
Sceen 2
Comments