"xhost: unable to open display" on Ubuntu

On Ubuntu you can use export DISPLAY=:0.0, xhost+ , but you cannot use ** export DISPLAY=lPaddress:0.0, xhost+** , b'cos it complains "xhost: unable to open display". Here is the solution:

sudo gedit /etc/gdm/gdm.schemas

Find:

<schema>
<key>security/DisallowTCP</key>
<signature>b</signature>
<default>true</default>
</schema>

Shift from true to false:

<schema>
<key>security/DisallowTCP</key>
<signature>b</signature>
<default>false</default>
</schema>

save file gdm.schemas

And reboot the machine(it seems not working if you only restart gdm).